public class ForExpressionCompiler extends ToIteratorCompiler
Constructor and Description |
---|
ForExpressionCompiler() |
Modifier and Type | Method and Description |
---|---|
void |
compileToIterator(CompilerService compiler,
Expression expression)
Generate bytecode to evaluate the ForExpression as an iterator
Precondition: none.
|
void |
compileToLoop(CompilerService compiler,
Expression expression,
LoopBodyGenerator loopBody)
The compileToLoop method compiles this expression in such a way that the code generated by the supplied
loopBody argument will be executed once for each item in the result of this expression.
|
void |
compileToPush(CompilerService compiler,
Expression expression)
Generate bytecode to evaluate the ForExpression in push mode
Precondition: none.
|
static java.lang.Class |
generateSequenceMappingAction(CompilerService compiler,
ForExpression expression,
Expression action,
int slotNumber)
Generate a mapping function with a map() method that returns an iterator over the results of
one iteration of the loop
|
compileToBoolean, compileToItem
allocateStatic, compileItemFromInt, compileToPrimitive, generateMethod, handleEmptyStringResult, printStackTop, unboxItem, verify, visitAnnotation, visitLineNumber
public void compileToPush(CompilerService compiler, Expression expression) throws CannotCompileException
compileToPush
in class ToIteratorCompiler
compiler
- the compiler serviceexpression
- the expression to be compiledCannotCompileException
public void compileToLoop(CompilerService compiler, Expression expression, LoopBodyGenerator loopBody) throws CannotCompileException
compileToLoop
in class ExpressionCompiler
compiler
- the compiler serviceexpression
- the expression to be compiledloopBody
- a generator which produces code to be executed once for every item in the result of this
expression, with that item being on the top of the bytecode stack.CannotCompileException
public void compileToIterator(CompilerService compiler, Expression expression) throws CannotCompileException
compileToIterator
in class ExpressionCompiler
compiler
- the compiler serviceexpression
- the expression to be compiledCannotCompileException
public static java.lang.Class generateSequenceMappingAction(CompilerService compiler, ForExpression expression, Expression action, int slotNumber) throws CannotCompileException
compiler
- the CompilerServiceexpression
- the "for" expression itselfaction
- the body of the "for" loop, which represents the expression to be compiledCannotCompileException
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.