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

Examples of com.google.gwt.dev.js.ast.JsVars.JsVar


    private void generateClassLiteral(JDeclarationStatement decl, JsVars vars) {
      JField field = (JField) decl.getVariableRef().getTarget();
      JsName jsName = names.get(field);
      this.accept(decl.getInitializer());
      JsExpression classObjectAlloc = pop();
      JsVar var = new JsVar(decl.getSourceInfo(), jsName);
      var.setInitExpr(classObjectAlloc);
      vars.add(var);
    }
View Full Code Here


      SourceInfo sourceInfo = program.createSourceInfoSynthetic(
          GenerateJavaScriptAST.class, "gwtOnLoad");

      JsName entryName = topScope.findExistingName("$entry");
      entryName.setObfuscatable(true);
      JsVar entryVar = new JsVar(sourceInfo, entryName);
      JsInvocation registerEntryCall = new JsInvocation(sourceInfo);
      JsFunction registerEntryFunction = indexedFunctions.get("Impl.registerEntry");
      registerEntryCall.setQualifier(registerEntryFunction.getName().makeRef(
          sourceInfo));
      entryVar.setInitExpr(registerEntryCall);
      JsVars entryVars = new JsVars(sourceInfo);
      entryVars.add(entryVar);
      globalStmts.add(entryVars);

      JsName gwtOnLoadName = topScope.declareName("gwtOnLoad");
View Full Code Here

    private void generateLongLiterals(JsVars vars) {
      for (Entry<Long, JsName> entry : longLits.entrySet()) {
        JsName jsName = entry.getValue();
        JsExpression longObjectAlloc = longObjects.get(jsName);
        JsVar var = new JsVar(vars.getSourceInfo().makeChild(
            GenerateJavaScriptVisitor.class, "Long literal " + entry.getKey()),
            jsName);
        var.setInitExpr(longObjectAlloc);
        vars.add(var);
      }
    }
View Full Code Here

    private void generatePackageNames(JsVars vars) {
      for (Iterator it = packageNames.entrySet().iterator(); it.hasNext();) {
        Map.Entry entry = (Entry) it.next();
        String packageName = (String) entry.getKey();
        JsName name = (JsName) entry.getValue();
        JsVar jsVar = new JsVar(name);
        jsVar.setInitExpr(jsProgram.getStringLiteral(packageName));
        vars.add(jsVar);
      }
    }
View Full Code Here

      for (int i = 0; i < program.getJsonTypeTable().size(); ++i) {
        JsonObject jsonObject = (JsonObject) program.getJsonTypeTable().get(i);
        accept(jsonObject);
        arrayLit.getExpressions().add((JsExpression) pop());
      }
      JsVar var = new JsVar(jsName);
      var.setInitExpr(arrayLit);
      vars.add(var);
    }
View Full Code Here

      JsExpression rhs = (JsExpression) pop();
      JsName name = getName(x);

      if (x.isStatic()) {
        // setup a var for the static
        JsVar var = new JsVar(name);
        var.setInitExpr(rhs);
        push(var);
      } else {
        // for non-statics, only setup an assignment if needed
        if (rhs != null) {
          JsNameRef fieldRef = name.makeRef();
View Full Code Here

      for (int i = 0; i < locals.size(); ++i) {
        JsName name = (JsName) names.get(x.locals.get(i));
        String ident = name.getIdent();
        if (!alreadySeen.contains(ident)) {
          alreadySeen.add(ident);
          vars.add(new JsVar(name));
        }
      }

      if (!vars.isEmpty()) {
        jsFunc.getBody().getStatements().add(0, vars);
View Full Code Here

      // declare some global vars
      JsVars vars = new JsVars();

      // reserve the "_" identifier
      vars.add(new JsVar(globalTemp));
      generatePackageNames(vars);
      globalStatements.add(vars);

      generateNullFunc(globalStatements);
      return true;
View Full Code Here

          string = "interface " + type.getName();
        } else {
          string = type.getName();
        }
        JsStringLiteral stringLiteral = jsProgram.getStringLiteral(string);
        JsVar var = new JsVar(jsName);
        var.setInitExpr(stringLiteral);
        vars.add(var);
      }
    }
View Full Code Here

      JsExpression rhs = (JsExpression) pop();
      JsName name = names.get(x);

      if (x.isStatic()) {
        // setup a var for the static
        JsVar var = new JsVar(x.getSourceInfo(), name);
        var.setInitExpr(rhs);
        push(var);
      } else {
        // for non-statics, only setup an assignment if needed
        if (rhs != null) {
          JsNameRef fieldRef = name.makeRef(x.getSourceInfo());
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.js.ast.JsVars.JsVar

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.