Package com.google.gwt.dev.jjs

Examples of com.google.gwt.dev.jjs.SourceInfo


      Collection<JsStringLiteral> toCreate, Map<JsStringLiteral, JsName> names) {
    if (toCreate.size() > 0) {
      // Create the pool of variable names.
      JsVars vars = new JsVars(program.createSourceInfoSynthetic(
          JsStringInterner.class, "Interned string pool"));
      SourceInfo sourceInfo = program.createSourceInfoSynthetic(
          JsStringInterner.class, "Interned string assignment");
      for (JsStringLiteral literal : toCreate) {
        JsVar var = new JsVar(sourceInfo, names.get(literal));
        var.setInitExpr(literal);
        vars.add(var);
View Full Code Here


        localVariableNames.add(var.getName());

        // Extract the initialization expression
        JsExpression init = var.getInitExpr();
        if (init != null) {
          SourceInfo sourceInfo = var.getSourceInfo().makeChild(
              JsInliner.class, "Hoisted initializer into inline site");
          JsBinaryOperation assignment = new JsBinaryOperation(sourceInfo,
              JsBinaryOperator.ASG);
          assignment.setArg1(var.getName().makeRef(sourceInfo));
          assignment.setArg2(init);
View Full Code Here

   * created with a JsName that has not yet had its static reference set. This
   * is the case in GenerateJavaScriptAST after the names and scopes visitor has
   * been run, but before the AST is fully realized.
   */
  private SourceInfo maybeUpdateSourceInfo() {
    SourceInfo toReturn = super.getSourceInfo();
    if (!hasStaticRef && name != null) {
      JsNode<?> staticRef = name.getStaticRef();
      if (staticRef != null) {
        toReturn.copyMissingCorrelationsFrom(name.getStaticRef().getSourceInfo());
        hasStaticRef = true;
      }
    }
    return toReturn;
  }
View Full Code Here

      // The body can't be empty if we have local variables to create
      assert !statements.isEmpty();

      // Find or create the JsVars as the first statement
      SourceInfo sourceInfo = x.getSourceInfo().makeChild(
          InliningVisitor.class, "Synthetic locals");
      JsVars vars;
      if (statements.get(0) instanceof JsVars) {
        vars = (JsVars) statements.get(0);
      } else {
View Full Code Here

       * Build up the new comma expression from right-to-left; building the
       * rightmost comma expressions first. Bootstrapping with i.previous()
       * ensures that this logic will function correctly in the case of a single
       * expression.
       */
      SourceInfo sourceInfo = x.getSourceInfo().makeChild(
          InliningVisitor.class, "Inlined invocation");
      ListIterator<JsExpression> i = hoisted.listIterator(hoisted.size());
      JsExpression op = i.previous();
      while (i.hasPrevious()) {
        JsBinaryOperation outerOp = new JsBinaryOperation(sourceInfo,
View Full Code Here

    /**
     * Perform the restructuring on a list of statements. Blocks are created as
     * necessary to prevent any given block from exceeding the maximum size.
     */
    private void restructure(List<JsStatement> statements) {
      SourceInfo sourceInfo = program.createSourceInfoSynthetic(
          JsIEBlockSizeVisitor.class, "Restructured to reduce block size");
      // This outer loop will collapse the newly-created block into super-blocks
      while (statements.size() > MAX_BLOCK_SIZE) {
        ListIterator<JsStatement> i = statements.listIterator();
        List<JsStatement> statementsInNewBlock = null;
View Full Code Here

    JsScope topScope = jsProgram.getScope();
    JsName funcName = topScope.declareName(getModuleFunctionName());
    funcName.setObfuscatable(false);

    try {
      SourceInfo sourceInfo = jsProgram.createSourceInfoSynthetic(
          StandardLinkerContext.class, "Linker-derived JS");
      JsParser.parseInto(sourceInfo, topScope, jsProgram.getGlobalBlock(), r);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Unable to parse JavaScript", e);
      throw new UnableToCompleteException();
View Full Code Here

  private JsScope getScope() {
    return scopeStack.peek();
  }

  private SourceInfo makeSourceInfo(Node node) {
    SourceInfo parent = sourceInfoStack.peek();
    int lineno = node.getLineno();
    if (lineno == -1) {
      // Rhino only reports line numbers for statement nodes, not expressions
      return parent;
    }
    SourceInfo toReturn = program.createSourceInfo(lineno, parent.getFileName());
    toReturn.copyMissingCorrelationsFrom(parent);
    return toReturn;
  }
View Full Code Here

    return new JsBinaryOperation(makeSourceInfo(node), op, to1, to2);
  }

  private JsBlock mapBlock(Node nodeStmts) throws JsParserException {
    SourceInfo info = makeSourceInfo(nodeStmts);
    JsBlock block = new JsBlock(info);
    pushSourceInfo(info);
    mapStatements(block.getStatements(), nodeStmts);
    popSourceInfo();
    return block;
View Full Code Here

    } else {
      fromBody = ifNode.getFirstChild();
      fromTestExpr = ifNode.getFirstChild().getNext();
    }

    SourceInfo info = makeSourceInfo(ifNode);
    pushSourceInfo(info);

    // Map the test expression.
    //
    JsExpression toTestExpr = mapExpression(fromTestExpr);
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.SourceInfo

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.