static class DirectiveNode.MacroCallNode extends DirectiveNode
#macro (mymacro $x $y) ... #end, then a call of that macro looks like
#mymacro (xvalue yvalue). The call is represented by an instance of this class. The
definition itself does not appear in the parse tree.
Evaluating a macro involves temporarily setting the parameter variables ($x $y in
the example) to thunks representing the argument expressions, evaluating the macro body, and
restoring any previous values that the parameter variables had.
DirectiveNode.ForEachNode, DirectiveNode.IfNode, DirectiveNode.MacroCallNode, DirectiveNode.SetNode| Modifier and Type | Field and Description |
|---|---|
private Macro |
macro |
private java.lang.String |
name |
private com.google.common.collect.ImmutableList<Node> |
thunks |
lineNumber| Constructor and Description |
|---|
MacroCallNode(int lineNumber,
java.lang.String name,
com.google.common.collect.ImmutableList<Node> argumentNodes) |
| Modifier and Type | Method and Description |
|---|---|
(package private) int |
argumentCount() |
(package private) java.lang.Object |
evaluate(EvaluationContext context)
Returns the result of evaluating this node in the given context.
|
(package private) java.lang.String |
name() |
(package private) void |
setMacro(Macro macro) |
cons, emptyNode, evaluationException, evaluationExceptionprivate final java.lang.String name
private final com.google.common.collect.ImmutableList<Node> thunks
private Macro macro
MacroCallNode(int lineNumber,
java.lang.String name,
com.google.common.collect.ImmutableList<Node> argumentNodes)
java.lang.String name()
int argumentCount()
void setMacro(Macro macro)
java.lang.Object evaluate(EvaluationContext context)
Node2 + 3 to 5 in order to set
$x to 5 in #set ($x = 2 + 3). Or it may be used directly as part of the
template output, for example evaluating replacing name by Fred in
My name is $name..