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

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


      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<JsExpression> 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

      JsBinaryOperation op = (JsBinaryOperation) expr;
      if (!(op.getArg2() instanceof JsInvocation)) {
        return;
      }

      JsInvocation i = (JsInvocation) op.getArg2();
      JsExpression q = i.getQualifier();
      if (!(q instanceof JsNameRef)) {
        return;
      }

      JsName name = ((JsNameRef) q).getName();
View Full Code Here

      JsCatch c = new JsCatch(info, currentFunction.getScope(), "e");
      JsName paramName = c.getParameter().getName();

      // caught(e)
      JsInvocation caughtCall = new JsInvocation(info);
      caughtCall.setQualifier(caughtFunction.getName().makeRef(info));
      caughtCall.getArguments().add(paramName.makeRef(info));

      // e = caught(e)
      JsBinaryOperation asg = new JsBinaryOperation(info, JsBinaryOperator.ASG,
          paramName.makeRef(info), caughtCall);
View Full Code Here

        // Use a clone instead of modifying the original JSNI
        // __gwt_makeTearOff(obj, dispId, paramCount)
        SourceInfo newSourceInfo = x.getSourceInfo().makeChild(getClass(),
            "Replace JSNI ref for hosted mode");
        JsInvocation rewritten = new JsInvocation(newSourceInfo);
        rewritten.setQualifier(new JsNameRef(newSourceInfo, "__gwt_makeTearOff"));

        List<JsExpression> arguments = rewritten.getArguments();
        if (q == null) {
          q = program.getNullLiteral();
        }
        arguments.add(q);
        arguments.add(program.getNumberLiteral(dispId));
View Full Code Here

              paramCount = ((Constructor<?>) member).getParameterTypes().length;
            }

            SourceInfo newSourceInfo = x.getSourceInfo().makeChild(getClass(),
                "Replace JSNI ref for hosted mode");
            JsInvocation inner = new JsInvocation(newSourceInfo);
            inner.setQualifier(new JsNameRef(newSourceInfo,
                "__gwt_makeJavaInvoke"));
            inner.getArguments().add(program.getNumberLiteral(paramCount));

            JsInvocation outer = new JsInvocation(newSourceInfo);
            outer.setQualifier(inner);
            JsExpression q = ref.getQualifier();
            if (q == null) {
              q = program.getNullLiteral();
            }
            List<JsExpression> arguments = outer.getArguments();
            arguments.add(q);
            arguments.add(program.getNumberLiteral(dispId));
            arguments.addAll(x.getArguments());

            accept(outer);
View Full Code Here

        // Use a clone instead of modifying the original JSNI
        // __gwt_makeTearOff(obj, dispId, paramCount)
        SourceInfo newSourceInfo = x.getSourceInfo().makeChild(getClass(),
            "Replace JSNI ref for hosted mode");
        JsInvocation rewritten = new JsInvocation(newSourceInfo);
        rewritten.setQualifier(new JsNameRef(newSourceInfo, "__gwt_makeTearOff"));

        List<JsExpression> arguments = rewritten.getArguments();
        if (q == null) {
          q = program.getNullLiteral();
        }
        arguments.add(q);
        arguments.add(program.getNumberLiteral(dispId));
View Full Code Here

              paramCount = ((Constructor<?>) member).getParameterTypes().length;
            }

            SourceInfo newSourceInfo = x.getSourceInfo().makeChild(getClass(),
                "Replace JSNI ref for hosted mode");
            JsInvocation inner = new JsInvocation(newSourceInfo);
            inner.setQualifier(new JsNameRef(newSourceInfo,
                "__gwt_makeJavaInvoke"));
            inner.getArguments().add(program.getNumberLiteral(paramCount));

            JsInvocation outer = new JsInvocation(newSourceInfo);
            outer.setQualifier(inner);
            JsExpression q = ref.getQualifier();
            if (q == null) {
              q = program.getNullLiteral();
            }
            List<JsExpression> arguments = outer.getArguments();
            arguments.add(q);
            arguments.add(program.getNumberLiteral(dispId));
            arguments.addAll(x.getArguments());

            accept(outer);
View Full Code Here

    for (JMethod entryMethod : jprogram.entryMethods.get(splitPoint)) {
      JsName name = map.nameForMethod(entryMethod);
      assert name != null;
      SourceInfo sourceInfo = jsprogram.getSourceInfo().makeChild(
          FragmentExtractor.class, "call to entry function " + splitPoint);
      JsInvocation call = new JsInvocation(sourceInfo);
      call.setQualifier(name.makeRef(sourceInfo));
      callStats.add(call.makeStmt());
    }
    return callStats;
  }
View Full Code Here

    JMethod loadedMethod = jprogram.getIndexedMethod("AsyncFragmentLoader.browserLoaderLeftoversFragmentHasLoaded");
    JsName loadedMethodName = map.nameForMethod(loadedMethod);
    SourceInfo sourceInfo = jsprogram.getSourceInfo().makeChild(
        FragmentExtractor.class,
        "call to browserLoaderLeftoversFragmentHasLoaded ");
    JsInvocation call = new JsInvocation(sourceInfo);
    call.setQualifier(loadedMethodName.makeRef(sourceInfo));
    List<JsStatement> newStats = Collections.<JsStatement> singletonList(call.makeStmt());
    return newStats;
  }
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.