public class GenJsExprsVisitor extends AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>
Precondition: MsgNode should not exist in the tree.
| Modifier and Type | Class and Description |
|---|---|
static class |
GenJsExprsVisitor.GenJsExprsVisitorFactory
Injectable factory for creating an instance of this class.
|
| Modifier and Type | Field and Description |
|---|---|
protected List<CodeChunk.WithValue> |
chunks
List to collect the results.
|
protected IsComputableAsJsExprsVisitor |
isComputableAsJsExprsVisitor |
| Modifier | Constructor and Description |
|---|---|
protected |
GenJsExprsVisitor(SoyJsSrcOptions options,
GenCallCodeUtils genCallCodeUtils,
IsComputableAsJsExprsVisitor isComputableAsJsExprsVisitor,
GenJsExprsVisitor.GenJsExprsVisitorFactory genJsExprsVisitorFactory,
TranslationContext translationContext,
ErrorReporter errorReporter,
TemplateAliases templateAliases) |
| Modifier and Type | Method and Description |
|---|---|
List<CodeChunk.WithValue> |
exec(SoyNode node)
Executes the function defined by this visitor.
|
List<CodeChunk.WithValue> |
execOnChildren(SoyNode.ParentSoyNode<?> node)
Executes this visitor on the children of the given node, without visiting the given node
itself.
|
protected void |
visitCallNode(CallNode node)
Example:
|
protected void |
visitCallParamContentNode(CallParamContentNode node) |
protected void |
visitIfCondNode(IfCondNode node) |
protected void |
visitIfElseNode(IfElseNode node) |
protected void |
visitIfNode(IfNode node)
Example:
|
protected void |
visitMsgHtmlTagNode(MsgHtmlTagNode node)
Example:
|
protected void |
visitMsgPlaceholderNode(MsgPlaceholderNode node) |
protected void |
visitPrintNode(PrintNode node)
Example:
|
protected void |
visitRawTextNode(RawTextNode node)
Example:
|
protected void |
visitTemplateNode(TemplateNode node) |
visit, visitCallBasicNode, visitCallDelegateNode, visitCallParamNode, visitCallParamValueNode, visitChildren, visitChildrenAllowingConcurrentModification, visitDebuggerNode, visitForIfemptyNode, visitForNode, visitForNonemptyNode, visitHtmlAttributeNode, visitHtmlAttributeValueNode, visitHtmlCloseTagNode, visitHtmlCommentNode, visitHtmlOpenTagNode, visitLetContentNode, visitLetNode, visitLetValueNode, visitLogNode, visitMsgFallbackGroupNode, visitMsgNode, visitMsgPluralCaseNode, visitMsgPluralDefaultNode, visitMsgPluralNode, visitMsgSelectCaseNode, visitMsgSelectDefaultNode, visitMsgSelectNode, visitMsgSubstUnitNode, visitPrintDirectiveNode, visitSoyFileNode, visitSoyFileSetNode, visitSoyNode, visitSwitchCaseNode, visitSwitchDefaultNode, visitSwitchNode, visitTemplateBasicNode, visitTemplateDelegateNode, visitVeLogNodevisitChildren, visitChildrenAllowingConcurrentModificationprotected final IsComputableAsJsExprsVisitor isComputableAsJsExprsVisitor
protected List<CodeChunk.WithValue> chunks
protected GenJsExprsVisitor(SoyJsSrcOptions options, GenCallCodeUtils genCallCodeUtils, IsComputableAsJsExprsVisitor isComputableAsJsExprsVisitor, GenJsExprsVisitor.GenJsExprsVisitorFactory genJsExprsVisitorFactory, TranslationContext translationContext, ErrorReporter errorReporter, TemplateAliases templateAliases)
jsExprTranslator - Instance of JsExprTranslator to use.genCallCodeUtils - Instance of GenCallCodeUtils to use.isComputableAsJsExprsVisitor - The IsComputableAsJsExprsVisitor used by this instance
(when needed).genJsExprsVisitorFactory - Factory for creating an instance of GenJsExprsVisitor.templateAliases - A mapping for looking up the function name for a given fully qualified
name.public List<CodeChunk.WithValue> exec(SoyNode node)
NodeVisitorexec in interface NodeVisitor<SoyNode,List<CodeChunk.WithValue>>exec in class AbstractNodeVisitor<SoyNode,List<CodeChunk.WithValue>>node - The node to execute the function on.public List<CodeChunk.WithValue> execOnChildren(SoyNode.ParentSoyNode<?> node)
protected void visitTemplateNode(TemplateNode node)
visitTemplateNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitRawTextNode(RawTextNode node)
I'm feeling lucky!generates
'I\'m feeling lucky!'
visitRawTextNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitMsgPlaceholderNode(MsgPlaceholderNode node)
visitMsgPlaceholderNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitMsgHtmlTagNode(MsgHtmlTagNode node)
<a href="{$url}">
might generate
'<a href="' + opt_data.url + '">'
visitMsgHtmlTagNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitPrintNode(PrintNode node)
{$boo.foo}
{$goo.moo + 5}
might generate
opt_data.boo.foo gooData4.moo + 5
visitPrintNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitIfNode(IfNode node)
{if $boo}
AAA
{elseif $foo}
BBB
{else}
CCC
{/if}
might generate
(opt_data.boo) ? AAA : (opt_data.foo) ? BBB : CCC
visitIfNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitIfCondNode(IfCondNode node)
visitIfCondNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitIfElseNode(IfElseNode node)
visitIfElseNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitCallNode(CallNode node)
{call some.func data="all" /}
{call some.func data="$boo.foo" /}
{call some.func}
{param key="goo" value="$moo" /}
{/call}
{call some.func data="$boo"}
{param key="goo"}Blah{/param}
{/call}
might generate
some.func(opt_data)
some.func(opt_data.boo.foo)
some.func({goo: opt_data.moo})
some.func(soy.$$assignDefaults({goo: 'Blah'}, opt_data.boo))
visitCallNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>protected void visitCallParamContentNode(CallParamContentNode node)
visitCallParamContentNode in class AbstractSoyNodeVisitor<List<CodeChunk.WithValue>>