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

Examples of com.google.gwt.dev.js.ast.JsFunction.makeStmt()


      JsStatements globalStmts = jsProgram.getGlobalBlock().getStatements();

      if (typeOracle.hasClinit(x)) {
        JsFunction clinitFunc = (JsFunction) jsFuncs.get(0);
        handleClinit(clinitFunc);
        globalStmts.add(clinitFunc.makeStmt());
      }

      // setup fields
      JsVars vars = new JsVars();
      for (int i = 0; i < jsFields.size(); ++i) {
View Full Code Here


      // Generate entry methods
      List/* <JsFunction> */entryFuncs = popList(x.entryMethods.size()); // entryMethods
      for (int i = 0; i < entryFuncs.size(); ++i) {
        JsFunction func = (JsFunction) entryFuncs.get(i);
        if (func != null) {
          globalStmts.add(func.makeStmt());
        }
      }

      generateGwtOnLoad(entryFuncs, globalStmts);

View Full Code Here

       *   }
       * }
       * </pre>
       */
      JsFunction gwtOnLoad = new JsFunction(topScope);
      globalStmts.add(gwtOnLoad.makeStmt());
      JsName gwtOnLoadName = topScope.declareName("gwtOnLoad");
      gwtOnLoadName.setObfuscatable(false);
      gwtOnLoad.setName(gwtOnLoadName);
      JsBlock body = new JsBlock();
      gwtOnLoad.setBody(body);
View Full Code Here

    private void generateNullFunc(JsStatements globalStatements) {
      // handle null method
      JsFunction nullFunc = new JsFunction(topScope, nullMethodName);
      nullFunc.setBody(new JsBlock());
      globalStatements.add(nullFunc.makeStmt());
    }

    private void generatePackageNames(JsVars vars) {
      for (Iterator it = packageNames.entrySet().iterator(); it.hasNext();) {
        Map.Entry entry = (Entry) it.next();
View Full Code Here

        // seed function
        // function com_example_foo_Foo() { }
        JsFunction seedFunc = new JsFunction(topScope, seedFuncName);
        JsBlock body = new JsBlock();
        seedFunc.setBody(body);
        globalStmts.add(seedFunc.makeStmt());

        // setup prototype, assign to temp
        // _ = com_example_foo_Foo.prototype = new com_example_foo_FooSuper();
        JsNameRef lhs = prototype.makeRef();
        lhs.setQualifier(seedFuncName.makeRef());
View Full Code Here

        // instead of cloning it
        newFunc.setBody(dupMethod.getBody());
        // also copy the parameters from the old function
        newFunc.getParameters().addAll(dupMethod.getParameters());
        // add the new function to the top level list of statements
        fragment.getStatements().add(newFunc.makeStmt());
        newNamesByHoistedFunction.put(dupMethod, newName);
      }

      ReplaceDuplicateInvocationNameRefs rdup = new ReplaceDuplicateInvocationNameRefs(
          dfbr.getDuplicateMap(), dfbr.getBlacklist(), dupMethodMap, newNamesByHoistedFunction);
View Full Code Here

      // declare all methods into the global scope
      for (int i = 0; i < jsFuncs.size(); ++i) {
        JsFunction func = jsFuncs.get(i);
        if (func != null) {
          globalStmts.add(func.makeStmt());
        }
      }

      if (typeOracle.isInstantiatedType(x) && !program.isJavaScriptObject(x)) {
        generateClassSetup(x, globalStmts);
View Full Code Here

      List<JsStatement> globalStmts = jsProgram.getGlobalBlock().getStatements();

      if (x.hasClinit()) {
        JsFunction clinitFunc = jsFuncs.get(0);
        handleClinit(clinitFunc, null);
        globalStmts.add(clinitFunc.makeStmt());
      }

      // setup fields
      JsVars vars = new JsVars(x.getSourceInfo());
      for (int i = 0; i < jsFields.size(); ++i) {
View Full Code Here

          GenerateJavaScriptAST.class, "gwtOnLoad");
      JsName gwtOnLoadName = topScope.declareName("gwtOnLoad");
      gwtOnLoadName.setObfuscatable(false);
      JsFunction gwtOnLoad = new JsFunction(sourceInfo, topScope,
          gwtOnLoadName, true);
      globalStmts.add(gwtOnLoad.makeStmt());
      JsBlock body = new JsBlock(sourceInfo);
      gwtOnLoad.setBody(body);
      JsScope fnScope = gwtOnLoad.getScope();
      List<JsParameter> params = gwtOnLoad.getParameters();
      JsName errFn = fnScope.declareName("errFn");
View Full Code Here

          GenerateJavaScriptAST.class, "Null function");
      JsFunction nullFunc = new JsFunction(sourceInfo, topScope,
          nullMethodName, true);
      nullFunc.setBody(new JsBlock(sourceInfo));
      // Add it first, so that script-tag chunking in IFrameLinker works
      globalStatements.add(0, nullFunc.makeStmt());
    }

    private void generateSeedFuncAndPrototype(JClassType x,
        List<JsStatement> globalStmts) {
      SourceInfo sourceInfo = x.getSourceInfo().makeChild(
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.