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

The following examples show how to use com.google.javascript.rhino.Node#useSourceInfoIfMissingFromForTree() . 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 vote down vote up
/**
 * @param n
 */
private void replaceGoogDefines(Node n) {
  Node parent = n.getParent();
  Preconditions.checkState(parent.isExprResult());
  String name = n.getChildAtIndex(1).getString();
  Node value = n.getChildAtIndex(2).detachFromParent();

  Node replacement = NodeUtil.newQualifiedNameNodeDeclaration(
      compiler.getCodingConvention(), name, value, n.getJSDocInfo());
  replacement.useSourceInfoIfMissingFromForTree(n);
  parent.getParent().replaceChild(parent, replacement);
  compiler.reportCodeChange();
}
 
Example 2
Source File: Nopol2017_0010_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * @param n
 */
private void replaceGoogDefines(Node n) {
  Node parent = n.getParent();
  Preconditions.checkState(parent.isExprResult());
  String name = n.getChildAtIndex(1).getString();
  Node value = n.getChildAtIndex(2).detachFromParent();

  Node replacement = NodeUtil.newQualifiedNameNodeDeclaration(
      compiler.getCodingConvention(), name, value, n.getJSDocInfo());
  replacement.useSourceInfoIfMissingFromForTree(n);
  parent.getParent().replaceChild(parent, replacement);
  compiler.reportCodeChange();
}
 
Example 3
Source File: Closure_113_ProcessClosurePrimitives_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * @param n
 */
private void replaceGoogDefines(Node n) {
  Node parent = n.getParent();
  Preconditions.checkState(parent.isExprResult());
  String name = n.getChildAtIndex(1).getString();
  Node value = n.getChildAtIndex(2).detachFromParent();

  Node replacement = NodeUtil.newQualifiedNameNodeDeclaration(
      compiler.getCodingConvention(), name, value, n.getJSDocInfo());
  replacement.useSourceInfoIfMissingFromForTree(n);
  parent.getParent().replaceChild(parent, replacement);
  compiler.reportCodeChange();
}
 
Example 4
Source File: Closure_113_ProcessClosurePrimitives_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * @param n
 */
private void replaceGoogDefines(Node n) {
  Node parent = n.getParent();
  Preconditions.checkState(parent.isExprResult());
  String name = n.getChildAtIndex(1).getString();
  Node value = n.getChildAtIndex(2).detachFromParent();

  Node replacement = NodeUtil.newQualifiedNameNodeDeclaration(
      compiler.getCodingConvention(), name, value, n.getJSDocInfo());
  replacement.useSourceInfoIfMissingFromForTree(n);
  parent.getParent().replaceChild(parent, replacement);
  compiler.reportCodeChange();
}