Package com.google.javascript.rhino

Examples of com.google.javascript.rhino.InputId


   * Type checks a NAME node and retrieve its type.
   */
  private JSType testNameNode(String name) {
    Node node = Node.newString(Token.NAME, name);
    Node parent = new Node(Token.SCRIPT, node);
    parent.setInputId(new InputId("code"));

    Node externs = new Node(Token.SCRIPT);
    externs.setInputId(new InputId("externs"));

    Node externAndJsRoot = new Node(Token.BLOCK, externs, parent);
    externAndJsRoot.setIsSyntheticBlock(true);

    makeTypeCheck().processForTesting(null, parent);
View Full Code Here


    compiler.init(
        Lists.newArrayList(SourceFile.fromCode("[externs]", externs)),
        Lists.newArrayList(SourceFile.fromCode("[testcode]", js)),
        compiler.getOptions());

    Node n = compiler.getInput(new InputId("[testcode]")).getAstRoot(compiler);
    Node externsNode = compiler.getInput(new InputId("[externs]"))
        .getAstRoot(compiler);
    Node externAndJsRoot = new Node(Token.BLOCK, externsNode, n);
    externAndJsRoot.setIsSyntheticBlock(true);

    assertEquals("parsing error: " +
View Full Code Here

  public CompilerInput(SourceAst ast, boolean isExtern) {
    this(ast, ast.getInputId(), isExtern);
  }

  public CompilerInput(SourceAst ast, String inputId, boolean isExtern) {
    this(ast, new InputId(inputId), isExtern);
  }
View Full Code Here

    loader = ES6ModuleLoader.createNaiveLoader(compiler, ".");
  }

  public void testWindowsAddresses() {
    CompilerInput inputA = compiler.getInput(new InputId("js\\a.js"));
    CompilerInput inputB = compiler.getInput(new InputId("js\\b.js"));
    assertEquals("js/a.js", loader.getLoadAddress(inputA));
    assertEquals("js/b.js", loader.locate("./b.js", inputA));

  }
View Full Code Here

  private final SourceFile sourceFile;

  private Node root;

  SyntheticAst(String sourceName) {
    this.inputId = new InputId(sourceName);
    this.sourceFile = new SourceFile(sourceName);
    clearAst();
  }
View Full Code Here

    this.sourceFile = new SourceFile(sourceName);
    clearAst();
  }

  public SyntheticAst(Node root) {
    this.inputId = new InputId(root.getSourceFileName());
    this.sourceFile = new SourceFile(root.getSourceFileName());
    this.root = root;
  }
View Full Code Here

    if (checkTypes) {
      DefaultPassConfig passConfig = new DefaultPassConfig(null);
      CompilerPass typeResolver = passConfig.resolveTypes.create(compiler);
      Node externs = new Node(Token.SCRIPT);
      externs.setInputId(new InputId("externs"));
      Node externAndJsRoot = new Node(Token.BLOCK, externs, n);
      externAndJsRoot.setIsSyntheticBlock(true);
      typeResolver.process(externs, n);
      CompilerPass inferTypes = passConfig.inferTypes.create(compiler);
      inferTypes.process(externs, n);
View Full Code Here

      script = new Node(Token.SCRIPT, elements);
    } else {
      script = new Node(Token.SCRIPT);
    }

    InputId inputId = new InputId("fuzzedInput");
    script.setInputId(inputId);
    script.setSourceFileForTesting(inputId.getIdName());
    return script;
  }
View Full Code Here

    if (refMap == null || !root.isScript()) {
      resetGlobalVarReferences(refMapPatch);
      return;
    }

    InputId inputId = root.getInputId();
    Preconditions.checkNotNull(inputId);
    // Note there are two assumptions here (i) the order of compiler inputs
    // has not changed and (ii) all references are in the order they appear
    // in AST (this is enforced in ReferenceCollectionCallback).
    removeScriptReferences(inputId);
View Full Code Here

    Config config = new Config(extraAnnotations, extraSuppressions,
        parseDocumentation, LanguageMode.ECMASCRIPT3, false);
    StaticSourceFile file = new SimpleSourceFile("testcode", false);
    Node associatedNode = new Node(Token.SCRIPT);
    associatedNode.setInputId(new InputId(file.getName()));
    associatedNode.setStaticSourceFile(file);

    JsDocInfoParser jsdocParser = new JsDocInfoParser(
        stream(comment),
        comment,
View Full Code Here

TOP

Related Classes of com.google.javascript.rhino.InputId

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.