## com.saxonica.codegen
Class LetExpressionCompiler

    java.lang.Object
      com.saxonica.codegen.ExpressionCompiler
          com.saxonica.codegen.SequenceExpressionCompiler
              com.saxonica.codegen.LetExpressionCompiler

    public class LetExpressionCompiler

extends SequenceExpressionCompiler

Compiles Java code to implement a Let expression

Constructor Summary
`LetExpressionCompiler()`

Method Summary
`void` `compileAsLoop(CompilerService compiler, Expression expr, LoopAction action)` Compile an expression in the form of a loop.
`void` `compilePush(CompilerService compiler, Expression expr)` Compile code to push the results of the expression to the current output receiver
`String` `compileToCharSequence(CompilerService compiler, Expression expr)` Generate Java code to evaluate the expression as a CharSequence
`String` `compileToEffectiveBooleanValue(CompilerService compiler, Expression expr, ReturnAction options)` Compile code to produce the effective boolean value of the expression
`String` `compileToItem(CompilerService compiler, Expression expr)` Compile code to return the results of the expression as an Item.
`String` `compileToIterator(CompilerService compiler, Expression expr)` Compile code to produce a SequenceIterator over the results of the expression
`String` `compileToValueRepresentation(CompilerService compiler, Expression expr)` Generate Java code to evaluate the expression as a ValueRepresentation

Methods inherited from class com.saxonica.codegen.ExpressionCompiler
`compileAsLoopWithContext`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LetExpressionCompiler

    public LetExpressionCompiler()

Method Detail

### compileToIterator

    public String compileToIterator(CompilerService compiler,
                                    Expression expr)

  Compile code to produce a SequenceIterator over the results of the expression

  Specified by:
    `compileToIterator` in class `ExpressionCompiler`
  Parameters:
    `compiler` - The CompilerService
    `expr` - the LetExpression to be compiled
  Returns:
    the compiled Java expression

### compileToValueRepresentation

    public String compileToValueRepresentation(CompilerService compiler,
                                               Expression expr)

  Description copied from class: `ExpressionCompiler`
  Generate Java code to evaluate the expression as a ValueRepresentation

  Overrides:
    `compileToValueRepresentation` in class `ExpressionCompiler`
  Parameters:
    `compiler` - the compiler service
    `expr` - the expression to be compiled
  Returns:
    a simple Java expression (usually the name of a variable that has been declared) which will be of class `ValueRepresentation`, and which at run-time will hold the value of the expression

### compileAsLoop

    public void compileAsLoop(CompilerService compiler,
                              Expression expr,
                              LoopAction action)

  Compile an expression in the form of a loop. Default implementation.

  Overrides:
    `compileAsLoop` in class `ExpressionCompiler`
  Parameters:
    `compiler` - the CompilerService
    `expr` - the expression to be compiled
    `action` - the action to be taken to process each item in the sequence returned by the expression

### compilePush

    public void compilePush(CompilerService compiler,
                            Expression expr)

  Compile code to push the results of the expression to the current output receiver

  Overrides:
    `compilePush` in class `SequenceExpressionCompiler`
  Parameters:
    `compiler` - The CompilerService
    `expr` - the LetExpression to be compiled

### compileToItem

    public String compileToItem(CompilerService compiler,
                                Expression expr)

  Compile code to return the results of the expression as an Item. For use only when the cardinality is known to be zero-or-one

  Overrides:
    `compileToItem` in class `SequenceExpressionCompiler`
  Parameters:
    `compiler` - The CompilerService
    `expr` - the LetExpression to be compiled
  Returns:
    the compiled Java expression

### compileToEffectiveBooleanValue

    public String compileToEffectiveBooleanValue(CompilerService compiler,
                                                 Expression expr,
                                                 ReturnAction options)

  Compile code to produce the effective boolean value of the expression

  Overrides:
    `compileToEffectiveBooleanValue` in class `SequenceExpressionCompiler`
  Parameters:
    `compiler` - The CompilerService
    `expr` - the LetExpression to be compiled
    `options` -
  Returns:
    the compiled Java expression

### compileToCharSequence

    public String compileToCharSequence(CompilerService compiler,
                                        Expression expr)

  Description copied from class: `ExpressionCompiler`
  Generate Java code to evaluate the expression as a CharSequence

  Overrides:
    `compileToCharSequence` in class `SequenceExpressionCompiler`
  Parameters:
    `compiler` - the compiler service
    `expr` - the expression to be compiled
  Returns:
    a simple Java expression (usually the name of a variable that has been declared, or a string literal) which will be of class `CharSequence`, and which will hold the string value of the expression at run-time

Copyright (C) Michael H. Kay. All rights reserved.