Java Code Examples for com.google.javascript.rhino.Node#setLength()
The following examples show how to use
com.google.javascript.rhino.Node#setLength() .
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: Nopol2017_0010_s.java From coming with MIT License | 5 votes |
/** * The string in {@code n} is a reference name. Create a synthetic * node for it with all the proper source info, and add it to the symbol * table. */ private void maybeAddStringNodeToSymbolTable(Node n) { if (preprocessorSymbolTable == null) { return; } String name = n.getString(); Node syntheticRef = NodeUtil.newQualifiedNameNode( compiler.getCodingConvention(), name, n /* real source offsets will be filled in below */, name); // Offsets to add to source. Named for documentation purposes. final int forQuote = 1; final int forDot = 1; Node current = null; for (current = syntheticRef; current.isGetProp(); current = current.getFirstChild()) { int fullLen = current.getQualifiedName().length(); int namespaceLen = current.getFirstChild().getQualifiedName().length(); current.setSourceEncodedPosition(n.getSourcePosition() + forQuote); current.setLength(fullLen); current.getLastChild().setSourceEncodedPosition( n.getSourcePosition() + namespaceLen + forQuote + forDot); current.getLastChild().setLength( current.getLastChild().getString().length()); } current.setSourceEncodedPosition(n.getSourcePosition() + forQuote); current.setLength(current.getString().length()); maybeAddToSymbolTable(syntheticRef); }
Example 2
Source File: Nopol2017_0010_t.java From coming with MIT License | 5 votes |
/** * The string in {@code n} is a reference name. Create a synthetic * node for it with all the proper source info, and add it to the symbol * table. */ private void maybeAddStringNodeToSymbolTable(Node n) { if (preprocessorSymbolTable == null) { return; } String name = n.getString(); Node syntheticRef = NodeUtil.newQualifiedNameNode( compiler.getCodingConvention(), name, n /* real source offsets will be filled in below */, name); // Offsets to add to source. Named for documentation purposes. final int forQuote = 1; final int forDot = 1; Node current = null; for (current = syntheticRef; current.isGetProp(); current = current.getFirstChild()) { int fullLen = current.getQualifiedName().length(); int namespaceLen = current.getFirstChild().getQualifiedName().length(); current.setSourceEncodedPosition(n.getSourcePosition() + forQuote); current.setLength(fullLen); current.getLastChild().setSourceEncodedPosition( n.getSourcePosition() + namespaceLen + forQuote + forDot); current.getLastChild().setLength( current.getLastChild().getString().length()); } current.setSourceEncodedPosition(n.getSourcePosition() + forQuote); current.setLength(current.getString().length()); maybeAddToSymbolTable(syntheticRef); }
Example 3
Source File: Closure_113_ProcessClosurePrimitives_s.java From coming with MIT License | 5 votes |
/** * The string in {@code n} is a reference name. Create a synthetic * node for it with all the proper source info, and add it to the symbol * table. */ private void maybeAddStringNodeToSymbolTable(Node n) { if (preprocessorSymbolTable == null) { return; } String name = n.getString(); Node syntheticRef = NodeUtil.newQualifiedNameNode( compiler.getCodingConvention(), name, n /* real source offsets will be filled in below */, name); // Offsets to add to source. Named for documentation purposes. final int forQuote = 1; final int forDot = 1; Node current = null; for (current = syntheticRef; current.isGetProp(); current = current.getFirstChild()) { int fullLen = current.getQualifiedName().length(); int namespaceLen = current.getFirstChild().getQualifiedName().length(); current.setSourceEncodedPosition(n.getSourcePosition() + forQuote); current.setLength(fullLen); current.getLastChild().setSourceEncodedPosition( n.getSourcePosition() + namespaceLen + forQuote + forDot); current.getLastChild().setLength( current.getLastChild().getString().length()); } current.setSourceEncodedPosition(n.getSourcePosition() + forQuote); current.setLength(current.getString().length()); maybeAddToSymbolTable(syntheticRef); }
Example 4
Source File: Closure_113_ProcessClosurePrimitives_t.java From coming with MIT License | 5 votes |
/** * The string in {@code n} is a reference name. Create a synthetic * node for it with all the proper source info, and add it to the symbol * table. */ private void maybeAddStringNodeToSymbolTable(Node n) { if (preprocessorSymbolTable == null) { return; } String name = n.getString(); Node syntheticRef = NodeUtil.newQualifiedNameNode( compiler.getCodingConvention(), name, n /* real source offsets will be filled in below */, name); // Offsets to add to source. Named for documentation purposes. final int forQuote = 1; final int forDot = 1; Node current = null; for (current = syntheticRef; current.isGetProp(); current = current.getFirstChild()) { int fullLen = current.getQualifiedName().length(); int namespaceLen = current.getFirstChild().getQualifiedName().length(); current.setSourceEncodedPosition(n.getSourcePosition() + forQuote); current.setLength(fullLen); current.getLastChild().setSourceEncodedPosition( n.getSourcePosition() + namespaceLen + forQuote + forDot); current.getLastChild().setLength( current.getLastChild().getString().length()); } current.setSourceEncodedPosition(n.getSourcePosition() + forQuote); current.setLength(current.getString().length()); maybeAddToSymbolTable(syntheticRef); }
Example 5
Source File: ProcessClosurePrimitives.java From astor with GNU General Public License v2.0 | 5 votes |
/** * The string in {@code n} is a reference name. Create a synthetic * node for it with all the proper source info, and add it to the symbol * table. */ private void maybeAddStringNodeToSymbolTable(Node n) { if (preprocessorSymbolTable == null) { return; } String name = n.getString(); Node syntheticRef = NodeUtil.newQualifiedNameNode( compiler.getCodingConvention(), name, n /* real source offsets will be filled in below */, name); // Offsets to add to source. Named for documentation purposes. final int FOR_QUOTE = 1; final int FOR_DOT = 1; Node current = null; for (current = syntheticRef; current.isGetProp(); current = current.getFirstChild()) { int fullLen = current.getQualifiedName().length(); int namespaceLen = current.getFirstChild().getQualifiedName().length(); current.setSourceEncodedPosition(n.getSourcePosition() + FOR_QUOTE); current.setLength(fullLen); current.getLastChild().setSourceEncodedPosition( n.getSourcePosition() + namespaceLen + FOR_QUOTE + FOR_DOT); current.getLastChild().setLength( current.getLastChild().getString().length()); } current.setSourceEncodedPosition(n.getSourcePosition() + FOR_QUOTE); current.setLength(current.getString().length()); maybeAddToSymbolTable(syntheticRef); }
Example 6
Source File: Closure_42_IRFactory_s.java From coming with MIT License | 4 votes |
private void maybeSetLengthFrom(Node node, AstNode source) { if (config.isIdeMode) { node.setLength(source.getLength()); } }
Example 7
Source File: Cardumen_0017_t.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }
Example 8
Source File: Closure_42_IRFactory_t.java From coming with MIT License | 4 votes |
private void maybeSetLengthFrom(Node node, AstNode source) { if (config.isIdeMode) { node.setLength(source.getLength()); } }
Example 9
Source File: Closure_109_JsDocInfoParser_s.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }
Example 10
Source File: Closure_109_JsDocInfoParser_t.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }
Example 11
Source File: Closure_133_JsDocInfoParser_s.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }
Example 12
Source File: Closure_133_JsDocInfoParser_t.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }
Example 13
Source File: Closure_37_IRFactory_s.java From coming with MIT License | 4 votes |
private void maybeSetLengthFrom(Node node, AstNode source) { if (config.isIdeMode) { node.setLength(source.getLength()); } }
Example 14
Source File: Closure_32_JsDocInfoParser_s.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }
Example 15
Source File: Closure_32_JsDocInfoParser_t.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }
Example 16
Source File: Closure_122_IRFactory_s.java From coming with MIT License | 4 votes |
private void maybeSetLengthFrom(Node node, AstNode source) { if (config.isIdeMode) { node.setLength(source.getLength()); } }
Example 17
Source File: Closure_122_IRFactory_t.java From coming with MIT License | 4 votes |
private void maybeSetLengthFrom(Node node, AstNode source) { if (config.isIdeMode) { node.setLength(source.getLength()); } }
Example 18
Source File: Nopol2017_0025_s.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }
Example 19
Source File: IRFactory.java From astor with GNU General Public License v2.0 | 4 votes |
private void maybeSetLengthFrom(Node node, AstNode source) { if (config.isIdeMode) { node.setLength(source.getLength()); } }
Example 20
Source File: Cardumen_0017_s.java From coming with MIT License | 4 votes |
private Node newStringNode(String s, int lineno, int charno) { Node n = Node.newString(s, lineno, charno).clonePropsFrom(templateNode); n.setLength(s.length()); return n; }