|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.bytecode.ExpressionCompiler com.saxonica.bytecode.ToIteratorCompiler com.saxonica.bytecode.BlockCompiler
public class BlockCompiler
Generate bytecode for a call to a Block expression. A block typically represents either an expression of the form (a, b, c, d), or an XSLT sequence constructor.
Constructor Summary | |
---|---|
BlockCompiler()
|
Method Summary | |
---|---|
void |
compileToIterator(CompilerService compiler,
Expression expression)
Generate bytecode to evaluate the BlockExpression 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 BlockExpression in push mode Precondition: none. |
Methods inherited from class com.saxonica.bytecode.ToIteratorCompiler |
---|
compileToBoolean, compileToItem |
Methods inherited from class com.saxonica.bytecode.ExpressionCompiler |
---|
allocateStatic, compileItemFromInt, compileItemFromString, compileToPrimitive, generateMethod, getConfiguration, handleEmptyStringResult, setConfiguration, throwXPathException, throwXPathException, unboxItem, verify, visitAnnotation, visitLineNumber |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BlockCompiler()
Method Detail |
---|
public void compileToPush(CompilerService compiler, Expression expression) throws CannotCompileException
compileToPush
in class ToIteratorCompiler
compiler
- the compiler serviceexpression
- the expression to be compiled
CannotCompileException
public void compileToLoop(CompilerService compiler, Expression expression, LoopBodyGenerator loopBody) throws CannotCompileException
ExpressionCompiler
Note that the compileToLoop() method must not be used where there is a need to maintain the value of position() or size(), or equivalents such as updating range variables. It is therefore generally used only for compiling aggregate functions such as count() and sum().
This has proved something of an obstacle. Attempts to compile path expressions as nested loops have failed in the case where there is a dependency on position() or last(): the current dependency mechanism doesn't always allow these cases to be detected (it only tells us when an expression uses position() or last(), not when it needs to maintain position() and last()). Hence this mode of compilation is not widely implemented (other than by the default implementation) and is currently used only when compiling sum() and count().
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 compiled
CannotCompileException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |