public class ExpressionEmitter extends Emitter
startOfBlock| Constructor and Description |
|---|
ExpressionEmitter(parsii.tokenizer.Position startOfBlock,
Expression expression)
Creates a new instance at the given position with the given expression.
|
| 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()
Reduces the internal expression.
|
String |
toString() |
void |
visitExpressions(Function<parsii.tokenizer.Position,ExpressionVisitor> visitorSupplier)
Visits all expressions contained in this emitter or its children.
|
emit, getStartOfBlockpublic ExpressionEmitter(parsii.tokenizer.Position startOfBlock,
Expression expression)
startOfBlock - the position where the emitter was declaredexpression - the expression to declare at runtimepublic 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()
Note that we deliberately do not convert a constant expression into a ConstantEmitter as the escaper
might be changed at runtime.
reduce in class EmitterGlobalRenderContext.setEscaper(Function)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 RenderExceptionCopyright © 2018. All rights reserved.