private Node createTemplateNode() { // The Node type choice is arbitrary. Node templateNode = new Node(Token.SCRIPT); templateNode.setStaticSourceFile(sourceFile); return templateNode; }
private Node createTemplateNode() { // The Node type choice is arbitrary. Node templateNode = IR.script(); templateNode.setStaticSourceFile( this.sourceFile); return templateNode; }
private Node createTemplateNode() { // The Node type choice is arbitrary. Node templateNode = new Node(Token.SCRIPT); templateNode.setStaticSourceFile(sourceFile); return templateNode; }
@Override public void clearAst() { root = IR.script(); root.setInputId(inputId); root.setStaticSourceFile(sourceFile); }
@Override public void clearAst() { root = IR.script(); root.setInputId(inputId); root.setStaticSourceFile(sourceFile); }
public final void setStaticSourceFileFrom(Node other) { // Make sure source file prop nodes are not duplicated. if (other.propListHead != null && (this.propListHead == null || (this.propListHead.propType == Prop.SOURCE_FILE.ordinal() && this.propListHead.next == null))) { // Either the node has only Prop.SOURCE_FILE as a property or has not properties. PropListItem tail = other.propListHead; while (tail.next != null) { tail = tail.next; } if (tail.propType == Prop.SOURCE_FILE.ordinal()) { propListHead = tail; return; } } setStaticSourceFile(other.getStaticSourceFile()); }
/** * Overwrite all the source information in this node with * that of {@code other}. */ public Node useSourceInfoFrom(Node other) { putProp(ORIGINALNAME_PROP, other.getProp(ORIGINALNAME_PROP)); setStaticSourceFile(other.getStaticSourceFile()); sourcePosition = other.sourcePosition; setLength(other.getLength()); return this; }
/** * Copies source file and name information from the other * node given to the current node. Used for maintaining * debug information across node append and remove operations. * @return this */ // TODO(nicksantos): The semantics of this method are ill-defined. Delete it. public Node copyInformationFrom(Node other) { if (getProp(ORIGINALNAME_PROP) == null) { putProp(ORIGINALNAME_PROP, other.getProp(ORIGINALNAME_PROP)); } if (getStaticSourceFile() == null) { setStaticSourceFile(other.getStaticSourceFile()); sourcePosition = other.sourcePosition; } return this; }
private void addExtern() { Node name = IR.name(PROTECTOR_FN); name.putBooleanProp(Node.IS_CONSTANT_NAME, true); Node var = IR.var(name); // Add "@noalias" so we can strip the method when AliasExternals is enabled. JSDocInfoBuilder builder = new JSDocInfoBuilder(false); builder.recordNoAlias(); var.setJSDocInfo(builder.build()); CompilerInput input = compiler.getSynthesizedExternsInput(); name.setStaticSourceFile(input.getSourceFile()); var.setStaticSourceFile(input.getSourceFile()); input.getAstRoot(compiler).addChildrenToBack(var); compiler.reportCodeChange(); }
/** * Adds a name declaration to the current marker. */ public void markName(String name, StaticSourceFile file, int lineno, int charno) { if (currentMarker != null) { // Record the name as both a SourcePosition<String> and a // SourcePosition<Node>. The <String> form is deprecated, // because <Node> is more consistent with how other name // references are handled (see #markTypeNode) // // TODO(nicksantos): Remove all uses of the Name position // and replace them with the NameNode position. JSDocInfo.TrimmedStringPosition position = new JSDocInfo.TrimmedStringPosition(); position.setItem(name); position.setPositionInformation(lineno, charno, lineno, charno + name.length()); currentMarker.setName(position); JSDocInfo.NamePosition nodePos = new JSDocInfo.NamePosition(); Node node = Node.newString(Token.NAME, name, lineno, charno); node.setLength(name.length()); node.setStaticSourceFile(file); nodePos.setItem(node); nodePos.setPositionInformation(lineno, charno, lineno, charno + name.length()); currentMarker.setNameNode(nodePos); } }
/** * Overwrite all the source information in this node with * that of {@code other} iff the source info is missing. */ public Node useSourceInfoIfMissingFrom(Node other) { if (getProp(ORIGINALNAME_PROP) == null) { putProp(ORIGINALNAME_PROP, other.getProp(ORIGINALNAME_PROP)); } if (getStaticSourceFile() == null) { setStaticSourceFile(other.getStaticSourceFile()); sourcePosition = other.sourcePosition; setLength(other.getLength()); } return this; }
/** * 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); }
/** * 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); }
root.setStaticSourceFile(sourceFile);
root.setStaticSourceFile(sourceFile);