Java Code Examples for com.google.javascript.rhino.Node#setStaticSourceFile()

The following examples show how to use com.google.javascript.rhino.Node#setStaticSourceFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Cardumen_0017_s.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 2
Source File: Closure_109_JsDocInfoParser_s.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 3
Source File: JsDocInfoParserTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private JSDocInfo parse(String comment, boolean parseDocumentation,
    boolean parseFileOverview, String... warnings) {
  TestErrorReporter errorReporter = new TestErrorReporter(null, warnings);

  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),
      new Comment(0, 0, CommentType.JSDOC, comment),
      associatedNode,
      config, errorReporter);

  if (fileLevelJsDocBuilder != null) {
    jsdocParser.setFileLevelJsDocBuilder(fileLevelJsDocBuilder);
  }

  jsdocParser.parse();

  assertTrue("expected warnings were not reported",
      errorReporter.hasEncounteredAllWarnings());

  if (parseFileOverview) {
    return jsdocParser.getFileOverviewJSDocInfo();
  } else {
    return jsdocParser.retrieveAndResetParsedJSDocInfo();
  }
}
 
Example 4
Source File: Closure_133_JsDocInfoParser_s.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 5
Source File: Closure_133_JsDocInfoParser_t.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 6
Source File: JsDocInfoParser.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 7
Source File: Closure_31_Compiler_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds a new Script AST to the compile state. If a script for the same file
 * already exists the script will not be added, instead a call to
 * #replaceScript should be used.
 *
 * @param ast the ast of the new file
 */
public void addNewScript(JsAst ast) {
  if (!addNewSourceAst(ast)) {
    return;
  }
  Node emptyScript = new Node(Token.SCRIPT);
  InputId inputId = ast.getInputId();
  emptyScript.setInputId(inputId);
  emptyScript.setStaticSourceFile(
      SourceFile.fromCode(inputId.getIdName(), ""));

  processNewScript(ast, emptyScript);
}
 
Example 8
Source File: Closure_32_JsDocInfoParser_s.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 9
Source File: Closure_32_JsDocInfoParser_t.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 10
Source File: Compiler.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds a new Script AST to the compile state. If a script for the same file
 * already exists the script will not be added, instead a call to
 * #replaceScript should be used.
 *
 * @param ast the ast of the new file
 */
public void addNewScript(JsAst ast) {
  if (!addNewSourceAst(ast)) {
    return;
  }
  Node emptyScript = new Node(Token.SCRIPT);
  InputId inputId = ast.getInputId();
  emptyScript.setInputId(inputId);
  emptyScript.setStaticSourceFile(
      SourceFile.fromCode(inputId.getIdName(), ""));

  processNewScript(ast, emptyScript);
}
 
Example 11
Source File: Closure_18_Compiler_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Adds a new Script AST to the compile state. If a script for the same file
 * already exists the script will not be added, instead a call to
 * #replaceScript should be used.
 *
 * @param ast the ast of the new file
 */
public void addNewScript(JsAst ast) {
  if (!addNewSourceAst(ast)) {
    return;
  }
  Node emptyScript = new Node(Token.SCRIPT);
  InputId inputId = ast.getInputId();
  emptyScript.setInputId(inputId);
  emptyScript.setStaticSourceFile(
      SourceFile.fromCode(inputId.getIdName(), ""));

  processNewScript(ast, emptyScript);
}
 
Example 12
Source File: Nopol2017_0025_s.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 13
Source File: Nopol2017_0025_t.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 14
Source File: Cardumen_0017_t.java    From coming with MIT License 5 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(
    this.associatedNode != null ?
    this.associatedNode.getStaticSourceFile() :
    null);
  return templateNode;
}
 
Example 15
Source File: Closure_122_IRFactory_s.java    From coming with MIT License 4 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = new Node(Token.SCRIPT);
  templateNode.setStaticSourceFile(sourceFile);
  return templateNode;
}
 
Example 16
Source File: Closure_122_IRFactory_t.java    From coming with MIT License 4 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = new Node(Token.SCRIPT);
  templateNode.setStaticSourceFile(sourceFile);
  return templateNode;
}
 
Example 17
Source File: Closure_37_IRFactory_t.java    From coming with MIT License 4 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = new Node(Token.SCRIPT);
  templateNode.setStaticSourceFile(sourceFile);
  return templateNode;
}
 
Example 18
Source File: Closure_37_IRFactory_s.java    From coming with MIT License 4 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = new Node(Token.SCRIPT);
  templateNode.setStaticSourceFile(sourceFile);
  return templateNode;
}
 
Example 19
Source File: Closure_42_IRFactory_t.java    From coming with MIT License 4 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = new Node(Token.SCRIPT);
  templateNode.setStaticSourceFile(sourceFile);
  return templateNode;
}
 
Example 20
Source File: Closure_42_IRFactory_s.java    From coming with MIT License 4 votes vote down vote up
private Node createTemplateNode() {
  // The Node type choice is arbitrary.
  Node templateNode = new Node(Token.SCRIPT);
  templateNode.setStaticSourceFile(sourceFile);
  return templateNode;
}