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

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


  protected static JsFunction isFunctionDecl(JsStatement stmt) {
    if (stmt instanceof JsExprStmt) {
      JsExprStmt exprStmt = (JsExprStmt) stmt;
      JsExpression expr = exprStmt.getExpression();
      if (expr instanceof JsFunction) {
        JsFunction func = (JsFunction) expr;
        if (func.getName() != null) {
          return func;
        }
      }
    }
    return null;
View Full Code Here


    public MustExecVisitor() {
    }

    @Override
    public void endVisit(JsExprStmt x, JsContext<JsStatement> ctx) {
      JsFunction func = isFunctionDecl(x);
      if (func != null) {
        mustExec.add(x);
      }
    }
View Full Code Here

    if (x == scopeStack.peek()) {
      ListIterator<JsStatement> itr = x.getStatements().listIterator();
      itrStack.push(itr);
      while (itr.hasNext()) {
        JsStatement stmt = itr.next();
        JsFunction func = JsStaticEval.isFunctionDecl(stmt);
        // Already at the top level.
        if (func != null) {
          dontMove.add(func);
        }
        accept(stmt);
View Full Code Here

    }

    // Rip the body out of the parsed function and attach the JavaScript
    // AST to the method.
    //
    JsFunction fn = (JsFunction) ((JsExprStmt) stmts.get(0)).getExpression();
    return fn;
  }
View Full Code Here

            "Property providers must specify a JavaScript body", null);
        throw new UnableToCompleteException();
      }

      int lineNumber = childSchema.getStartLineNumber();
      JsFunction fn = parseJsBlock(lineNumber, script);

      property.setProvider(new PropertyProvider(fn.getBody().toSource()));
    }
View Full Code Here

              memberFactory.get(type).addField(member);
              membersByCorrelation.put(c, member);
              break;
            }
            case FUNCTION: {
              JsFunction function = c.getFunction();
              StandardFunctionMember member = memberFactory.get(function);
              membersByCorrelation.put(c, member);
              functionsMutable.add(member);
              break;
            }
View Full Code Here

   * Gets the body of a JSNI method, with Java refs escaped for hosted mode
   * injection.
   */
  public static String getJavaScriptForHostedMode(TreeLogger logger,
      DispatchIdOracle dispatchInfo, JsniMethod jsniMethod) {
    JsFunction func = jsniMethod.function();
    if (func == null) {
      return null;
    }
    return generateJavaScriptForHostedMode(dispatchInfo, jsniMethod.program(),
        func.getBody());
  }
View Full Code Here

        }
        enclosingType = InternalName.toBinaryName(String.valueOf(constantPoolName));
        loc = String.valueOf(cud.getFileName());
        lazyInitialized = true;
      }
      JsFunction jsFunction = parseJsniFunction(method, source, enclosingType,
          loc, jsProgram);
      if (jsFunction != null) {
        String jsniSignature = getJsniSignature(enclosingType, method);
        results.put(method, new JsniMethodImpl(jsniSignature, jsFunction));
      }
View Full Code Here

      try {
        List<JsStatement> result = JsParser.parse(jsInfo, jsProgram.getScope(),
            sr);
        JsExprStmt jsExprStmt = (JsExprStmt) result.get(0);
        JsFunction jsFunction = (JsFunction) jsExprStmt.getExpression();
        jsFunction.setFromJava(true);
        ((JsniMethodBody) newMethod.getBody()).setFunc(jsFunction);

        // Ensure that we've resolved the parameter and local references within
        // the JSNI method for later pruning.
        JsParameterResolver localResolver = new JsParameterResolver(jsFunction);
View Full Code Here

   * Gets the body of a JSNI method, with Java refs escaped for hosted mode
   * injection.
   */
  public static String getJavaScriptForHostedMode(TreeLogger logger,
      DispatchIdOracle dispatchInfo, JsniMethod jsniMethod) {
    JsFunction func = jsniMethod.function(logger);
    if (func == null) {
      return null;
    }
    return generateJavaScriptForHostedMode(dispatchInfo, jsniMethod.program(),
        func.getBody());
  }
View Full Code Here

TOP

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

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.