Return an iterable object that iterates over this node's children. The iterator does not support the optional operation {@link Iterator#remove()}.
To iterate over a node's children, one can write
Node n = ...; for (Node child : n.children()) { ...
173174175176177178179180181182183
Node scriptRoot = new JsAst(SourceFile.fromCode( "template", templateJs)).getAstRoot(compiler); Map<String, Node> beforeTemplates = Maps.newHashMap(); Map<String, Node> afterTemplates = Maps.newHashMap(); for (Node templateNode : scriptRoot.children()) { if (templateNode.isFunction()) { String fnName = templateNode.getFirstChild().getQualifiedName(); if (fnName.startsWith("before_")) { String templateName = fnName.substring("before_".length()); Preconditions.checkState(
342343344345346347348349350351352
return; } // If it is a var declaration, but no cross module names are declared // we also don't have to do anything. boolean hasCrossModuleChildren = false; for (Node c : parent.children()) { // Var child is no longer a name means it was transformed already // which means there was a cross module name. if (!c.isName() || isCrossModuleName(c.getString())) { hasCrossModuleChildren = true; break;
333334335336337338339340341342343
if (parent == null) { return false; } ArrayList<Node> siblings = Lists.newArrayList(parent.children()); int indexOfChildInParent = siblings.indexOf(child); switch(parent.getType()) { case Token.IF:
207208209210211212213214215216217
if (name.equals(current.getQualifiedName()) && current.getJSType() != null) { return current.getJSType(); } for (Node child : current.children()) { queue.push(child); } } return null; }
11151116111711181119112011211122112311241125
if (matcher.apply(current) && current.getJSType() != null) { return current.getJSType(); } for (Node child : current.children()) { queue.push(child); } } return null; }
395396397398399400401402403404405
Preconditions.checkState(caseNode == executingCase || executingCase.getType() != Token.DEFAULT); Node block = executingCase.getLastChild(); Preconditions.checkState(block.getType() == Token.BLOCK); if (block.hasChildren()) { for (Node blockChild : block.children()) { // If this is a block with a labelless break, it is useless. switch (blockChild.getType()) { case Token.BREAK: // A break to a different control structure isn't useless. return blockChild.getFirstChild() == null;
520521522523524525526527528529530
Node returnNode = fnChild.getFirstChild(); if (returnNode.getType() != Token.RETURN) { throw new MalformedException("RETURN node expected; found: " + getReadableTokenName(returnNode), returnNode); } for (Node child : returnNode.children()) { extractFromReturnDescendant(builder, child); } // Check that all placeholders from the message text have appropriate // object literal keys
213214215216217218219220221222223
} public Iterable<Node> getParameters() { Node n = getParametersNode(); if (n != null) { return n.children(); } else { return Collections.emptySet(); } }
332333334335336337338339340341342
467468469470471472473474475476477
// the second child is a wrapper for formal parameters child = child.getNext(); JsonML params = new JsonML(TagType.ParamDecl); element.appendChild(params); Iterator<Node> it = child.children().iterator(); while (it.hasNext()) { JsonML param = new JsonML(TagType.IdPatt); Node nameNode = it.next(); param.setAttribute(TagAttr.NAME, nameNode.getString()); params.appendChild(param);