public class InvokeTemplateEmitter extends Emitter
startOfBlock| Constructor and Description |
|---|
InvokeTemplateEmitter(parsii.tokenizer.Position startOfBlock,
String templateName)
Creates a new instance at the given position with the given target template.
|
| Modifier and Type | Method and Description |
|---|---|
Emitter |
copy()
Creates a deep copy of this emitter.
|
protected void |
emitToContext(LocalRenderContext context)
Actually produces the output while relying on the caller to properly handle any exception.
|
Emitter |
propagateVisitor(EmitterVisitor visitor)
Invokes the visitor on all sub emitters and on this emitter itself.
|
Emitter |
reduce()
Performs static optimizations at compile time.
|
void |
setArguments(Expression[] args)
Sets the argument expressions for the template invocation.
|
void |
setBlocks(Map<String,Emitter> blocks)
Sets the blocks to be applied, which can be referenced by the invoked template.
|
void |
visitExpressions(Function<parsii.tokenizer.Position,ExpressionVisitor> visitorSupplier)
Visits all expressions contained in this emitter or its children.
|
emit, getStartOfBlockpublic InvokeTemplateEmitter(parsii.tokenizer.Position startOfBlock,
String templateName)
startOfBlock - the position where the invocation was declaredtemplateName - the name of the template to invokepublic Emitter copy()
EmitterWhen templates are inlined, the parameters are propagated and constant expressions and conditions are evaluated at compile time. This yields faster and more efficient templates. In order to perform these optimizations, we need a copy of the template and all its emitters which can safely be modified.
public Emitter reduce()
EmitterCertain emitters can perform optimizations (evaluate constant expressions, combine constant outputs etc.) to create more efficient templates. This is especially important when a template is inlined, as this most probably provides a higher level of optimizations.
public Emitter propagateVisitor(EmitterVisitor visitor)
EmitterpropagateVisitor in class Emittervisitor - the visitor to invokepublic void visitExpressions(Function<parsii.tokenizer.Position,ExpressionVisitor> visitorSupplier)
EmittervisitExpressions in class EmittervisitorSupplier - a function which generates an ExpressionVisitor while supplying the current position (for
improved error messages).protected void emitToContext(LocalRenderContext context) throws Exception
EmitteremitToContext in class Emittercontext - the render context which provides access to the local and global environment and also the target
for the generated textException - all thrown exceptions are caught and converted into a RenderExceptionpublic void setArguments(Expression[] args)
Note that the order must match the arguments of the template itself.
args - the expressions to evaluate and supply as argumentsCopyright © 2018. All rights reserved.