Examples of JsInvocation


Examples of com.google.gwt.dev.js.ast.JsInvocation

       * the result expression ended up on the lhs of an assignment. A hack in
       * in endVisit(JBinaryOperation) rectifies the situation.
       */

      // See if we need a clinit
      JsInvocation jsInvocation = maybeCreateClinitCall(field);
      if (jsInvocation != null) {
        curExpr = createCommaExpression(jsInvocation, curExpr);
      }

      if (x.getInstance() != null) {
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

      if (!vars.isEmpty()) {
        jsFunc.getBody().getStatements().add(0, vars);
      }

      JsInvocation jsInvocation = maybeCreateClinitCall(x);
      if (jsInvocation != null) {
        jsFunc.getBody().getStatements().add(0, jsInvocation.makeStmt());
      }

      push(jsFunc);
      currentMethod = null;
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

    }

    // @Override
    public void endVisit(JMethodCall x, Context ctx) {
      JMethod method = x.getTarget();
      JsInvocation jsInvocation = new JsInvocation();

      popList(jsInvocation.getArguments(), x.getArgs().size()); // args

      JsNameRef qualifier;
      JsExpression unnecessaryQualifier = null;
      if (method.isStatic()) {
        if (x.getInstance() != null) {
          unnecessaryQualifier = (JsExpression) pop(); // instance
        }
        qualifier = getName(method).makeRef();
      } else {
        if (x.isStaticDispatchOnly()) {
          /*
           * Dispatch statically (odd case). This happens when a call that must
           * be static is targeting an instance method that could not be
           * transformed into a static. For example, making a super call into a
           * native method currently causes this, because we cannot currently
           * staticify native methods.
           *
           * Have to use a "call" construct.
           */
          JsName callName = objectScope.declareName("call");
          callName.setObfuscatable(false);
          qualifier = callName.makeRef();
          qualifier.setQualifier(getName(method).makeRef());
          jsInvocation.getArguments().add(0, (JsExpression) pop()); // instance
        } else {
          // Dispatch polymorphically (normal case).
          qualifier = getPolyName(method).makeRef();
          qualifier.setQualifier((JsExpression) pop()); // instance
        }
      }
      jsInvocation.setQualifier(qualifier);
      push(createCommaExpression(unnecessaryQualifier, jsInvocation));
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

              JsName jsName = getName(field);
              assert (jsName != null);
              x.resolve(jsName);

              // See if we need to add a clinit call to a static field ref
              JsInvocation clinitCall = maybeCreateClinitCall(field);
              if (clinitCall != null) {
                JsExpression commaExpr = createCommaExpression(clinitCall, x);
                ctx.replaceMe(commaExpr);
              }
            } else {
              JMethod method = (JMethod) node;
              if (x.getQualifier() == null) {
                JsName jsName = getName(method);
                assert (jsName != null);
                x.resolve(jsName);
              } else {
                JsName jsName = getPolyName(method);
                if (jsName == null) {
                  // this can occur when JSNI references an instance method on a
                  // type that was never actually instantiated.
                  jsName = nullMethodName;
                }
                x.resolve(jsName);
              }
            }
          }
        }
      }.accept(jsFunc);

      JsInvocation jsInvocation = maybeCreateClinitCall(x);
      if (jsInvocation != null) {
        jsFunc.getBody().getStatements().add(0, jsInvocation.makeStmt());
      }

      push(jsFunc);
      currentMethod = null;
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

      jsIf.setElseStmt(callBlock);
      jsTry.setTryBlock(callBlock);
      for (int i = 0; i < entryFuncs.size(); ++i) {
        JsFunction func = (JsFunction) entryFuncs.get(i);
        if (func != null) {
          JsInvocation call = new JsInvocation();
          call.setQualifier(func.getName().makeRef());
          callBlock.getStatements().add(call.makeStmt());
        }
      }
      JsCatch jsCatch = new JsCatch(fnScope, "e");
      jsTry.getCatches().add(jsCatch);
      JsBlock catchBlock = new JsBlock();
      jsCatch.setBody(catchBlock);
      JsInvocation errCall = new JsInvocation();
      catchBlock.getStatements().add(errCall.makeStmt());
      errCall.setQualifier(errFn.makeRef());
      errCall.getArguments().add(modName.makeRef());
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

        lhsName.setObfuscatable(false);
        JsNameRef lhs = lhsName.makeRef();
        lhs.setQualifier(globalTemp.makeRef());

        // rhs
        JsInvocation call = new JsInvocation();
        JsNameRef toStringRef = new JsNameRef(getPolyName(toStringMeth));
        toStringRef.setQualifier(new JsThisRef());
        call.setQualifier(toStringRef);
        JsReturn jsReturn = new JsReturn(call);
        JsFunction rhs = new JsFunction(topScope);
        JsBlock body = new JsBlock();
        body.getStatements().add(jsReturn);
        rhs.setBody(body);
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

      JsExpression asg = createAssignment(clinitFunc.getName().makeRef(),
          nullMethodName.makeRef());
      statements.add(0, asg.makeStmt());
      if (chainTo != null) {
        JMethod chainToMeth = (JMethod) chainTo.methods.get(0);
        JsInvocation jsInvocation = new JsInvocation();
        JsNameRef qualifier = getName(chainToMeth).makeRef();
        jsInvocation.setQualifier(qualifier);
        statements.add(1, jsInvocation.makeStmt());
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

      // class that does.
      while (!typeOracle.hasDirectClinit(enclosingType)) {
        enclosingType = enclosingType.extnds;
      }
      JMethod clinitMethod = (JMethod) enclosingType.methods.get(0);
      JsInvocation jsInvocation = new JsInvocation();
      jsInvocation.setQualifier(getName(clinitMethod).makeRef());
      return jsInvocation;
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

      // class that does.
      while (!typeOracle.hasDirectClinit(enclosingType)) {
        enclosingType = enclosingType.extnds;
      }
      JMethod clinitMethod = (JMethod) enclosingType.methods.get(0);
      JsInvocation jsInvocation = new JsInvocation();
      jsInvocation.setQualifier(getName(clinitMethod).makeRef());
      return jsInvocation;
    }
View Full Code Here

Examples of com.google.gwt.dev.js.ast.JsInvocation

       * the result expression ended up on the lhs of an assignment. A hack in
       * in endVisit(JBinaryOperation) rectifies the situation.
       */

      // See if we need a clinit
      JsInvocation jsInvocation = maybeCreateClinitCall(field);
      if (jsInvocation != null) {
        curExpr = createCommaExpression(jsInvocation, curExpr);
      }

      if (x.getInstance() != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.