Package com.google.gwt.dev.js.ast

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


     */
    private JsStatement constructFunctionCallStatement(JsName assignToVariableName,
        String indexedFunctionName, List<JsExpression> args) {

      SourceInfo sourceInfo = SourceOrigin.UNKNOWN;
      JsInvocation invocation = constructInvocation(indexedFunctionName, args);
      JsVar var = new JsVar(sourceInfo, assignToVariableName);
      var.setInitExpr(invocation);
      JsVars entryVars = new JsVars(sourceInfo);
      entryVars.add(var);
      return entryVars;
View Full Code Here


     * Constructs an invocation for an indexed function.
     */
    private JsInvocation constructInvocation(SourceInfo sourceInfo,
        String indexedFunctionName, List<JsExpression> args) {
      JsFunction functionToInvoke = indexedFunctions.get(indexedFunctionName);
      return new JsInvocation(sourceInfo, functionToInvoke, args);
    }
View Full Code Here

        JsNameRef lhs = createNativeToStringRef(globalTemp.makeRef(sourceInfo));

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

        return methodRef;
      } else {
        // call JHCSU.makeBridgeMethod(functionRefToBeCalled)
        JsFunction makeBridgeMethod = indexedFunctions.get("JavaClassHierarchySetupUtil.makeBridgeMethod");
        JsNameRef makeBridgeMethodRef = makeBridgeMethod.getName().makeRef(methodRef.getSourceInfo());
        JsInvocation invokeBridge = new JsInvocation(methodRef.getSourceInfo());
        invokeBridge.setQualifier(makeBridgeMethodRef);
        invokeBridge.getArguments().add(methodRef);
        invokeBridge.getArguments().add(m.getType() == JPrimitiveType.LONG ?
            JsBooleanLiteral.TRUE : JsBooleanLiteral.FALSE);
        JsArrayLiteral arrayLiteral = new JsArrayLiteral(m.getSourceInfo());
        for (JParameter p : m.getParams()) {
          if (p.getType() == JPrimitiveType.LONG) {
            arrayLiteral.getExpressions().add(JsBooleanLiteral.TRUE);
          } else {
            arrayLiteral.getExpressions().add(JsBooleanLiteral.FALSE);
          }
        }
        invokeBridge.getArguments().add(arrayLiteral);
        return invokeBridge;
      }
    }
View Full Code Here

                                           String lastProvidedNamespace, Pair<String, String> exportNamespacePair) {
      if (!lastProvidedNamespace.equals(exportNamespacePair.getLeft())) {
        if (jsInteropMode == OptionJsInteropMode.Mode.JS) {
          JsName provideFunc = indexedFunctions.get("JavaClassHierarchySetupUtil.provide").getName();
          JsNameRef provideFuncRef = provideFunc.makeRef(x.getSourceInfo());
          JsInvocation provideCall = new JsInvocation(x.getSourceInfo());

          provideCall.setQualifier(provideFuncRef);
          provideCall.getArguments().add(new JsStringLiteral(x.getSourceInfo(),
              exportNamespacePair.getLeft()));

          // _ = JCHSU.provide('foo.bar')
          JsExprStmt provideStat = createAssignment(globalTemp.makeRef(x.getSourceInfo()),
              provideCall).makeStmt();
View Full Code Here

        return null;
      }

      JMethod clinitMethod = targetType.getClinitMethod();
      SourceInfo sourceInfo = x.getSourceInfo();
      return new JsInvocation(sourceInfo, names.get(clinitMethod).makeRef(sourceInfo));
    }
View Full Code Here

        return null;
      }

      JMethod clinitMethod = enclosingType.getClinitTarget().getClinitMethod();
      SourceInfo sourceInfo = x.getSourceInfo();
      return new JsInvocation(sourceInfo, names.get(clinitMethod).makeRef(sourceInfo));
    }
View Full Code Here

      return new JsBreak(makeSourceInfo(breakNode));
    }
  }

  private JsInvocation mapCall(Node callNode) throws JsParserException {
    JsInvocation invocation = new JsInvocation(makeSourceInfo(callNode));

    // Map the target expression.
    //
    Node from = callNode.getFirstChild();
    JsExpression to = mapExpression(from);
    invocation.setQualifier(to);

    // Iterate over and map the arguments.
    //
    List<JsExpression> args = invocation.getArguments();
    from = from.getNext();
    while (from != null) {
      to = mapExpression(from);
      args.add(to);
      from = from.getNext();
View Full Code Here

     * Cloning the invocation allows us to modify it without damaging other call
     * sites.
     */
    @Override
    public void endVisit(JsInvocation x, JsContext ctx) {
      JsInvocation toReturn = new JsInvocation(x.getSourceInfo());
      List<JsExpression> params = toReturn.getArguments();
      int size = x.getArguments().size();
      while (size-- > 0) {
        params.add(0, stack.pop());
      }
      toReturn.setQualifier(stack.pop());
      stack.push(toReturn);
    }
View Full Code Here

        }

        // Use a clone instead of modifying the original JSNI
        // __gwt_makeTearOff(obj, dispId, paramCount)
        SourceInfo info = x.getSourceInfo();
        JsInvocation rewritten = new JsInvocation(info);
        rewritten.setQualifier(new JsNameRef(info, "__gwt_makeTearOff"));

        List<JsExpression> arguments = rewritten.getArguments();
        if (q == null) {
          q = JsNullLiteral.INSTANCE;
        }
        arguments.add(q);
        arguments.add(new JsNumberLiteral(info, dispId));
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.js.ast.JsInvocation

Copyright © 2018 www.massapicom. 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.