当前位置: 首页>>代码示例>>Java>>正文


Java Node.addChildToBack方法代码示例

本文整理汇总了Java中com.google.javascript.rhino.Node.addChildToBack方法的典型用法代码示例。如果您正苦于以下问题:Java Node.addChildToBack方法的具体用法?Java Node.addChildToBack怎么用?Java Node.addChildToBack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.javascript.rhino.Node的用法示例。


在下文中一共展示了Node.addChildToBack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseRecordType

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/**
 * RecordType := '{' FieldTypeList '}'
 */
private Node parseRecordType(JsDocToken token) {
  Node recordType = newNode(Token.LC);
  Node fieldTypeList = parseFieldTypeList(token);

  if (fieldTypeList == null) {
    return reportGenericTypeSyntaxWarning();
  }

  skipEOLs();
  if (!match(JsDocToken.RC)) {
    return reportTypeSyntaxWarning("msg.jsdoc.missing.rc");
  }

  next();

  recordType.addChildToBack(fieldTypeList);
  return recordType;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:22,代码来源:JsDocInfoParser.java

示例2: getSideEffectsHookNode

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
private Node getSideEffectsHookNode() {
  Node hookNode = new Node(Token.HOOK);

  Node assign1 = new Node(Token.ASSIGN);
  assign1.addChildToBack(Node.newString(Token.NAME, "bar"));
  assign1.addChildToBack(Node.newNumber(0));

  Node assign2 = new Node(Token.ASSIGN);
  assign2.addChildToBack(Node.newString(Token.NAME, "baz"));
  assign2.addChildToBack(Node.newNumber(0));

  hookNode.addChildToBack(Node.newString(Token.NAME, "foo"));
  hookNode.addChildToBack(assign1);
  hookNode.addChildToBack(assign2);

  return hookNode;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:18,代码来源:GatherSideEffectSubexpressionsCallbackTest.java

示例3: processCatchClause

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
@Override
Node processCatchClause(CatchClause clauseNode) {
  AstNode catchVar = clauseNode.getVarName();
  Node node = new Node(Token.CATCH, transform(catchVar));
  if (clauseNode.getCatchCondition() != null) {
    node.addChildToBack(transform(clauseNode.getCatchCondition()));
  } else {
    Node catchCondition = new Node(Token.EMPTY);
    // Old Rhino used the position of the catchVar as the position
    // for the (nonexistent) error being caught.
    catchCondition.setLineno(catchVar.getLineno());
    int clauseAbsolutePosition =
        position2charno(catchVar.getAbsolutePosition());
    catchCondition.setCharno(clauseAbsolutePosition);
    node.addChildToBack(catchCondition);
  }
  node.addChildToBack(transform(clauseNode.getBody()));
  return node;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:20,代码来源:IRFactory.java

示例4: newFunctionNode

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/** Creates function name(params_0, ..., params_n) { body }. */
public static FunctionNode newFunctionNode(String name, List<Node> params,
    Node body, int lineno, int charno) {
  Node parameterParen = new Node(Token.LP, lineno, charno);
  for (Node param : params) {
    parameterParen.addChildToBack(param);
  }
  FunctionNode function = new FunctionNode(name, lineno, charno);
  function.addChildrenToBack(
      Node.newString(Token.NAME, name, lineno, charno));
  function.addChildToBack(parameterParen);
  function.addChildToBack(body);
  return function;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:15,代码来源:NodeUtil.java

示例5: buildCallNode

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/**
 * Builds a method call based on the the given method name,
 * argument and history.
 *
 * @param methodName Method to call.
 * @param argumentNode Method argument.
 * @param lineno line number in original source.
 * @param charno character offset in original line.
 */
protected final Node buildCallNode(String methodName, Node argumentNode,
                                   int lineno, int charno) {
  Node call = new Node(Token.CALL, lineno, charno);
  call.addChildToBack(Node.newString(Token.NAME, methodName));
  if (argumentNode != null) {
    call.addChildToBack(argumentNode.cloneTree());
  }
  return call;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:19,代码来源:FunctionRewriter.java

示例6: processVariableDeclaration

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
@Override
Node processVariableDeclaration(VariableDeclaration declarationNode) {
  Node node = new Node(Token.VAR);
  for (VariableInitializer child : declarationNode.getVariables()) {
    node.addChildToBack(transform(child));
  }
  return node;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:IRFactory.java

示例7: getSideEffectsAndNode

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
private Node getSideEffectsAndNode() {
  Node andNode = new Node(Token.AND);

  Node assign = new Node(Token.ASSIGN);
  assign.addChildToBack(Node.newString(Token.NAME, "bar"));
  assign.addChildToBack(Node.newNumber(0));

  andNode.addChildToBack(Node.newString(Token.NAME, "foo"));
  andNode.addChildToBack(assign);

  return andNode;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:13,代码来源:GatherSideEffectSubexpressionsCallbackTest.java

示例8: createPostOrderAlphabet

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/** 
 * Returns a Node tree with the post-order traversal a b c d e f g h i j k l m
 * and the in-order traversal m d a b c h e f g l i j k:
 * 
 *                                   m
 *                         ,---------|---------.
 *                         d         h         l
 *                      ,--|--.   ,--|--.   ,--|--.
 *                      a  b  c   e  f  g   i  j  k
 * 
 */
private static Node createPostOrderAlphabet() {
  Node a = Node.newString("a");
  Node b = Node.newString("b");
  Node c = Node.newString("c");
  Node d = Node.newString("d");
  Node e = Node.newString("e");
  Node f = Node.newString("f");
  Node g = Node.newString("g");
  Node h = Node.newString("h");
  Node i = Node.newString("i");
  Node j = Node.newString("j");
  Node k = Node.newString("k");
  Node l = Node.newString("l");
  Node m = Node.newString("m");
  
  d.addChildToBack(a);
  d.addChildToBack(b);
  d.addChildToBack(c);
  
  h.addChildrenToBack(e);
  h.addChildrenToBack(f);
  h.addChildrenToBack(g);
  
  l.addChildToBack(i);
  l.addChildToBack(j);
  l.addChildToBack(k);
  
  m.addChildToBack(d);
  m.addChildToBack(h);
  m.addChildToBack(l);
  
  return m;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:45,代码来源:CombinedCompilerPassTest.java

示例9: processIfStatement

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
@Override
Node processIfStatement(IfStatement statementNode) {
  Node node = new Node(Token.IF);
  node.addChildToBack(transform(statementNode.getCondition()));
  node.addChildToBack(transform(statementNode.getThenPart()));
  if (statementNode.getElsePart() != null) {
    node.addChildToBack(transform(statementNode.getElsePart()));
  }
  return node;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:11,代码来源:IRFactory.java

示例10: processReturnStatement

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
@Override
Node processReturnStatement(ReturnStatement statementNode) {
  Node node = new Node(Token.RETURN);
  if (statementNode.getReturnValue() != null) {
    node.addChildToBack(transform(statementNode.getReturnValue()));
  }
  return node;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:IRFactory.java

示例11: visit

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
@Override
public void visit(NodeTraversal t, Node n, Node parent) {
  if (n.getType() != Token.RETURN) {
    return;
  }

  Node call = newReportFunctionExitNode();
  Node returnRhs = n.removeFirstChild();
  if (returnRhs != null) {
    call.addChildToBack(returnRhs);
  }
  n.addChildToFront(call);
  compiler.reportCodeChange();
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:15,代码来源:InstrumentFunctions.java

示例12: getNoSideEffectsAndNode

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
private Node getNoSideEffectsAndNode() {
  Node andNode = new Node(Token.AND);

  andNode.addChildToBack(Node.newString(Token.NAME, "foo"));
  andNode.addChildToBack(Node.newString(Token.NAME, "bar"));

  return andNode;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:GatherSideEffectSubexpressionsCallbackTest.java

示例13: parseFieldType

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
/**
 * FieldType := FieldName | FieldName ':' TypeExpression
 */
private Node parseFieldType(JsDocToken token) {
  Node fieldName = parseFieldName(token);

  if (fieldName == null) {
    return null;
  }

  skipEOLs();
  if (!match(JsDocToken.COLON)) {
    return fieldName;
  }

  // Move to the colon.
  next();

  // Move to the token after the colon and parse
  // the type expression.
  skipEOLs();
  Node typeExpression = parseTypeExpression(next());

  if (typeExpression == null) {
    return null;
  }

  Node fieldType = newNode(Token.COLON);
  fieldType.addChildToBack(fieldName);
  fieldType.addChildToBack(typeExpression);
  return fieldType;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:33,代码来源:JsDocInfoParser.java

示例14: processGeneric

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
private Node processGeneric(
    com.google.javascript.jscomp.mozilla.rhino.Node n) {
  Node node = new Node(transformTokenType(n.getType()));
  for (com.google.javascript.jscomp.mozilla.rhino.Node child : n) {
    node.addChildToBack(transform((AstNode)child));
  }
  return node;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:IRFactory.java

示例15: processAstRoot

import com.google.javascript.rhino.Node; //导入方法依赖的package包/类
@Override
Node processAstRoot(AstRoot rootNode) {
  Node node = new ScriptOrFnNode(Token.SCRIPT);
  for (com.google.javascript.jscomp.mozilla.rhino.Node child : rootNode) {
    node.addChildToBack(transform((AstNode)child));
  }
  parseDirectives(node);
  return node;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:10,代码来源:IRFactory.java


注:本文中的com.google.javascript.rhino.Node.addChildToBack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。