Class ValueComparisonCompiler


  • public class ValueComparisonCompiler
    extends ToBooleanCompiler
    Generate code for a ValueComparison
    • Constructor Detail

      • ValueComparisonCompiler

        public ValueComparisonCompiler()
    • Method Detail

      • compileToItem

        public void compileToItem​(CompilerService compiler,
                                  Expression expression)
                           throws CannotCompileException
        Generate bytecode to evaluate the expression as an Item Precondition: none. Postcondition: the stack contains either an item (the result of the expression), or null (representing an empty sequence).
        Overrides:
        compileToItem in class ToBooleanCompiler
        Parameters:
        compiler - the compiler service
        expression - the expression to be compiled
        Throws:
        CannotCompileException - if the expression cannot be compiled to bytecode
      • compileToBoolean

        public void compileToBoolean​(CompilerService compiler,
                                     Expression expression)
                              throws CannotCompileException
        Generate bytecode to evaluate the ValueComparison as a boolean value Precondition: none. Postcondition: the stack contains an boolean value representing the result of the expression
        Specified by:
        compileToBoolean in class ExpressionCompiler
        Parameters:
        compiler - the compiler service
        expression - the expression to be compiled
        Throws:
        CannotCompileException - if the expression cannot be compiled to bytecode
      • translateOperator

        public static int translateOperator​(int op)