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

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


    }

    private JsObjectLiteral castMapToObjectLiteral(JsArrayLiteral arrayLit, SourceInfo sourceInfo) {
      JsObjectLiteral objLit = new JsObjectLiteral(sourceInfo);
      List<JsPropertyInitializer> props = objLit.getPropertyInitializers();
      JsNumberLiteral one = new JsNumberLiteral(sourceInfo, 1);
      for (JsExpression expr : arrayLit.getExpressions()) {
        JsPropertyInitializer prop = new JsPropertyInitializer(sourceInfo, expr, one);
        props.add(prop);
      }
      return objLit;
View Full Code Here


      if (namesByQueryId != null) {
        SourceInfo info = vars.getSourceInfo();
        int id = 0;
        for (JsName jsName : namesByQueryId) {
          JsVar var = new JsVar(info, jsName);
          var.setInitExpr(new JsNumberLiteral(info, id++));
          vars.add(var);
        }
      }
    }
View Full Code Here

        int newSeed = getSeedId(x);
        assert newSeed > 0;
        JClassType superClass = x.getSuperClass();
        int superSeed = (superClass == null) ? -1 : getSeedId(x.getSuperClass());
        // SeedUtil.defineSeed(queryId, superId, castableMap, constructors)
        defineSeed.getArguments().add(new JsNumberLiteral(x.getSourceInfo(),
            newSeed));
        defineSeed.getArguments().add(new JsNumberLiteral(x.getSourceInfo(),
            superSeed));
        JsExpression castMap = generateCastableTypeMap(x);
        defineSeed.getArguments().add(castMap);
      
        // Chain assign the same prototype to every live constructor.
View Full Code Here

          // Was pruned; this compilation must have no dynamic casts.
          return;
        }
        JsNameRef fieldRef = typeIdName.makeRef();
        fieldRef.setQualifier(globalTemp.makeRef());
        JsNumberLiteral typeIdLit = jsProgram.getNumberLiteral(typeId);
        JsExpression asg = createAssignment(fieldRef, typeIdLit);
        globalStmts.add(new JsExprStmt(asg));
      }
    }
View Full Code Here

      return (op == JsBinaryOperator.SUB || op == JsUnaryOperator.NEG)
          && (op2 == JsUnaryOperator.DEC || op2 == JsUnaryOperator.NEG)
          || (op == JsBinaryOperator.ADD && op2 == JsUnaryOperator.INC);
    }
    if (arg instanceof JsNumberLiteral) {
      JsNumberLiteral literal = (JsNumberLiteral) arg;
      return (op == JsBinaryOperator.SUB || op == JsUnaryOperator.NEG)
          && (literal.getValue() < 0);
    }
    return false;
  }
View Full Code Here

      return (op == JsBinaryOperator.SUB || op == JsUnaryOperator.NEG)
          && (op2 == JsUnaryOperator.DEC || op2 == JsUnaryOperator.NEG)
          || (op == JsBinaryOperator.ADD && op2 == JsUnaryOperator.INC);
    }
    if (arg instanceof JsNumberLiteral) {
      JsNumberLiteral literal = (JsNumberLiteral) arg;
      return (op == JsBinaryOperator.SUB || op == JsUnaryOperator.NEG)
          && (literal.getValue() < 0);
    }
    return false;
  }
View Full Code Here

public class JsAstTest extends TestCase {

  // TODO(rluble): flesh out the test.
  public void testEquality() {
    final SourceOrigin sourceInfo = SourceOrigin.UNKNOWN;
    JsNumberLiteral one = new JsNumberLiteral(sourceInfo, 1);
    JsNumberLiteral two = new JsNumberLiteral(sourceInfo, 2);
    JsArrayLiteral arrayOneTwoLiteral = new JsArrayLiteral(sourceInfo, one, two);
    JsArrayLiteral arrayOneTwoLiteral2 = new JsArrayLiteral(sourceInfo, one,two);
    JsArrayLiteral arrayTwoOneLiteral = new JsArrayLiteral(sourceInfo, two, one);

    JsObjectLiteral emptyObject = new JsObjectLiteral(sourceInfo);
View Full Code Here

          // Was pruned; this compilation must have no dynamic casts.
          return;
        }
        JsNameRef fieldRef = typeIdName.makeRef();
        fieldRef.setQualifier(globalTemp.makeRef());
        JsNumberLiteral typeIdLit = jsProgram.getNumberLiteral(typeId);
        JsExpression asg = createAssignment(fieldRef, typeIdLit);
        globalStmts.add(new JsExprStmt(asg));
      }
    }
View Full Code Here

      pair.setLabelExpr(new JsStringLiteral(info, filename));
      JsObjectLiteral lines = new JsObjectLiteral(info);
      List<JsPropertyInitializer> coverage = lines.getPropertyInitializers();
      for (int line : instrumentableLines.get(filename)) {
        coverage.add(new JsPropertyInitializer(info,
            new JsNumberLiteral(info, line), new JsNumberLiteral(info, 0)));
      }
      pair.setValueExpr(lines);
      properties.add(pair);
    }
    return baseline;
View Full Code Here

        return;
      }
      JsInvocation update = new JsInvocation(info,
          jsProgram.getIndexedFunction("CoverageUtil.cover"),
          new JsStringLiteral(info, info.getFileName()),
          new JsNumberLiteral(info, info.getStartLine()));
      ctx.replaceMe(new JsBinaryOperation(info, JsBinaryOperator.COMMA, update, x));
    }
View Full Code Here

TOP

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

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.