Examples of JsNameRef


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

    private void generateTypeId(JClassType x, JsStatements globalStmts) {
      int typeId = program.getTypeId(x);
      if (typeId >= 0) {
        JField typeIdField = program.getSpecialField("Object.typeId");
        JsNameRef fieldRef = getName(typeIdField).makeRef();
        fieldRef.setQualifier(globalTemp.makeRef());
        JsIntegralLiteral typeIdLit = jsProgram.getIntegralLiteral(BigInteger.valueOf(typeId));
        JsExpression asg = createAssignment(fieldRef, typeIdLit);
        globalStmts.add(new JsExprStmt(asg));
      }
    }
View Full Code Here

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

      }
    }

    private void generateTypeName(JClassType x, JsStatements globalStmts) {
      JField typeIdField = program.getSpecialField("Object.typeName");
      JsNameRef lhs = getName(typeIdField).makeRef();
      lhs.setQualifier(globalTemp.makeRef());

      // Split the full class name into package + class so package strings
      // can be merged.
      String className = getClassName(x.getName());
      String packageName = getPackageName(x.getName());
View Full Code Here

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

    private void generateVTables(JClassType x, JsStatements globalStmts) {
      for (int i = 0; i < x.methods.size(); ++i) {
        JMethod method = (JMethod) x.methods.get(i);
        if (!method.isStatic() && !method.isAbstract()) {
          JsNameRef lhs = getPolyName(method).makeRef();
          lhs.setQualifier(globalTemp.makeRef());
          JsNameRef rhs = getName(method).makeRef();
          JsExpression asg = createAssignment(lhs, rhs);
          globalStmts.add(new JsExprStmt(asg));
        }
      }
    }
View Full Code Here

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

          nullMethodName.makeRef());
      statements.add(0, asg.makeStmt());
      if (chainTo != null) {
        JMethod chainToMeth = (JMethod) chainTo.methods.get(0);
        JsInvocation jsInvocation = new JsInvocation();
        JsNameRef qualifier = getName(chainToMeth).makeRef();
        jsInvocation.setQualifier(qualifier);
        statements.add(1, jsInvocation.makeStmt());
      }
    }
View Full Code Here

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

          }
        }
      }.accept(func);

      for (int i = 0; i < nameRefs.size(); ++i) {
        JsNameRef nameRef = (JsNameRef) nameRefs.get(i);
        SourceInfo info = nativeMethod.getSourceInfo();
        // TODO: make this tighter when we have real source info
        // JSourceInfo info = translateInfo(nameRef.getInfo());
        String ident = nameRef.getIdent();
        HasEnclosingType node = (HasEnclosingType) program.jsniMap.get(ident);
        if (node == null) {
          node = parseJsniRef(info, x, ident);
          if (node == null) {
            continue; // already reported error
          }
          program.jsniMap.put(ident, node);
        }
        assert (node != null);
        CanBeStatic canBeStatic = (CanBeStatic) node;
        HasName hasName = (HasName) node;
        boolean isField = node instanceof JField;
        assert (isField || node instanceof JMethod);
        if (canBeStatic.isStatic() && nameRef.getQualifier() != null) {
          reportJsniError(info, x,
              "Cannot make a qualified reference to the static "
                  + (isField ? "field " : "method ") + hasName.getName());
        } else if (!canBeStatic.isStatic() && nameRef.getQualifier() == null) {
          reportJsniError(info, x,
              "Cannot make an unqualified reference to the instance "
                  + (isField ? "field " : "method ") + hasName.getName());
        }
View Full Code Here

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

      JsExpression expr = invoke.getQualifier();
      if (!(expr instanceof JsNameRef)) {
        return super.visit(invoke, ctx);
      }

      JsNameRef name = (JsNameRef) expr;
      if (!name.getIdent().equals("concat")) {
        return super.visit(invoke, ctx);
      }

      JsArrayLiteral headElements = (JsArrayLiteral) name.getQualifier();

      for (JsExpression ex : invoke.getArguments()) {
        JsArrayLiteral arg = (JsArrayLiteral) ex;
        headElements.getExpressions().addAll(arg.getExpressions());
      }
View Full Code Here

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

    @Override
    public void endVisit(JArrayLength x, Context ctx) {
      assert x.getInstance() != null : "Can't access the length of a null array";
      JsExpression qualifier = (JsExpression) pop();
      JsNameRef ref = arrayLength.makeRef(x.getSourceInfo());
      ref.setQualifier(qualifier);
      push(ref);
    }
View Full Code Here

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

      push(jsBlock);
    }

    @Override
    public void endVisit(JBreakStatement x, Context ctx) {
      JsNameRef labelRef = null;
      if (x.getLabel() != null) {
        JsLabel label = (JsLabel) pop(); // label
        labelRef = label.getName().makeRef(x.getSourceInfo());
      }
      push(new JsBreak(x.getSourceInfo(), labelRef));
View Full Code Here

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

      push(new JsConditional(x.getSourceInfo(), ifTest, thenExpr, elseExpr));
    }

    @Override
    public void endVisit(JContinueStatement x, Context ctx) {
      JsNameRef labelRef = null;
      if (x.getLabel() != null) {
        JsLabel label = (JsLabel) pop(); // label
        labelRef = label.getName().makeRef(x.getSourceInfo());
      }
      push(new JsContinue(x.getSourceInfo(), labelRef));
View Full Code Here

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

        push(null);
        return;
      }

      JsExpression initializer = (JsExpression) pop(); // initializer
      JsNameRef localRef = (JsNameRef) pop(); // localRef

      JVariable target = x.getVariableRef().getTarget();
      if (target instanceof JField && ((JField) target).getLiteralInitializer() != null) {
        // Will initialize at top scope; no need to double-initialize.
        push(null);
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.