Class BinaryExpression

All Implemented Interfaces:
OperatorIds, TypeConstants, TypeIds
Direct Known Subclasses:
AND_AND_Expression, CombinedBinaryExpression, EqualExpression, OR_OR_Expression

public class BinaryExpression extends OperatorExpression
  • Field Details

  • Constructor Details

  • Method Details

    • analyseCode

      public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo)
      Overrides:
      analyseCode in class Expression
    • updateFlowOnBooleanResult

      protected void updateFlowOnBooleanResult(FlowInfo flowInfo, boolean result)
      Description copied from class: Expression
      Back-propagation of flow info: before analysing a branch where a given condition is known to hold true/false respectively, ask the condition to contribute its information to the given flowInfo.
      Overrides:
      updateFlowOnBooleanResult in class Expression
      Parameters:
      flowInfo - the info to be used for analysing the branch
      result - condition result that would cause entering the branch
    • computeConstant

      public void computeConstant(BlockScope scope, int leftId, int rightId)
    • optimizedBooleanConstant

      public Constant optimizedBooleanConstant()
      Description copied from class: Expression
      Constant usable for bytecode pattern optimizations, but cannot be inlined since it is not strictly equivalent to the definition of constant expressions. In particular, some side-effects may be required to occur (only the end value is known).
      Overrides:
      optimizedBooleanConstant in class Expression
      Returns:
      Constant known to be of boolean type
    • generateCode

      public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired)
      Code generation for a binary operation
      Overrides:
      generateCode in class Expression
      Parameters:
      currentScope - org.eclipse.jdt.internal.compiler.lookup.BlockScope
      codeStream - org.eclipse.jdt.internal.compiler.codegen.CodeStream
      valueRequired - boolean
    • generateOptimizedBoolean

      public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Boolean operator code generation. Optimized operations are: <, <=, >, >=, &, |, ^
      Overrides:
      generateOptimizedBoolean in class Expression
    • generateOptimizedGreaterThan

      public void generateOptimizedGreaterThan(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Boolean generation for >
    • generateOptimizedGreaterThanOrEqual

      public void generateOptimizedGreaterThanOrEqual(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Boolean generation for >=
    • generateOptimizedLessThan

      public void generateOptimizedLessThan(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Boolean generation for <
    • generateOptimizedLessThanOrEqual

      public void generateOptimizedLessThanOrEqual(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Boolean generation for <=
    • generateLogicalAnd

      public void generateLogicalAnd(BlockScope currentScope, CodeStream codeStream, boolean valueRequired)
      Boolean generation for &
    • generateLogicalOr

      public void generateLogicalOr(BlockScope currentScope, CodeStream codeStream, boolean valueRequired)
      Boolean generation for |
    • generateLogicalXor

      public void generateLogicalXor(BlockScope currentScope, CodeStream codeStream, boolean valueRequired)
      Boolean generation for ^
    • generateOptimizedLogicalAnd

      public void generateOptimizedLogicalAnd(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Boolean generation for &
    • generateOptimizedLogicalOr

      public void generateOptimizedLogicalOr(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Boolean generation for |
    • generateOptimizedLogicalXor

      public void generateOptimizedLogicalXor(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Boolean generation for ^
    • buildStringForConcatation

      public void buildStringForConcatation(BlockScope blockScope, CodeStream codeStream, int typeID, StringBuilder recipe, List<TypeBinding> argTypes)
      Overrides:
      buildStringForConcatation in class Expression
    • generateOptimizedStringConcatenation

      public void generateOptimizedStringConcatenation(BlockScope blockScope, CodeStream codeStream, int typeID)
      Overrides:
      generateOptimizedStringConcatenation in class Expression
    • generateOptimizedStringConcatenationCreation

      public void generateOptimizedStringConcatenationCreation(BlockScope blockScope, CodeStream codeStream, int typeID)
      Overrides:
      generateOptimizedStringConcatenationCreation in class Expression
    • isCompactableOperation

      public boolean isCompactableOperation()
      Overrides:
      isCompactableOperation in class Expression
    • optimizedBooleanConstant

      public void optimizedBooleanConstant(int leftId, int operator, int rightId)
    • printExpressionNoParenthesis

      public StringBuilder printExpressionNoParenthesis(int indent, StringBuilder output)
      Specified by:
      printExpressionNoParenthesis in class OperatorExpression
    • addPatternVariables

      public void addPatternVariables(BlockScope scope, CodeStream codeStream)
      Overrides:
      addPatternVariables in class Expression
    • containsPatternVariable

      public boolean containsPatternVariable()
      Overrides:
      containsPatternVariable in class Statement
    • resolveType

      public TypeBinding resolveType(BlockScope scope)
      Description copied from class: Expression
      Resolve the type of this expression in the context of a blockScope
      Overrides:
      resolveType in class Expression
      Returns:
      Return the actual type of this expression after resolution
    • traverse

      public void traverse(ASTVisitor visitor, BlockScope scope)
      Description copied from class: Expression
      Traverse an expression in the context of a blockScope
      Overrides:
      traverse in class Expression