All Implemented Interfaces:
TypeConstants, TypeIds
Direct Known Subclasses:
GuardedPattern, TypePattern

public abstract class Pattern extends Expression
  • Field Details

    • accessorMethod

      protected MethodBinding accessorMethod
    • index

      public int index
  • Constructor Details

    • Pattern

      public Pattern()
  • Method Details

    • containsPatternVariable

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

      public Pattern getEnclosingPattern()
      Returns:
      the enclosingPattern
    • setEnclosingPattern

      public void setEnclosingPattern(RecordPattern enclosingPattern)
      Parameters:
      enclosingPattern - the enclosingPattern to set
    • coversType

      public boolean coversType(TypeBinding type)
      Implement the rules in the spec under 14.11.1.1 Exhaustive Switch Blocks
      Returns:
      whether pattern covers the given type or not
    • isAlwaysTrue

      public boolean isAlwaysTrue()
    • generateCode

      public void generateCode(BlockScope currentScope, CodeStream codeStream)
      Description copied from class: Expression
      Expression statements are plain expressions, however they generate like normal expressions with no value required.
      Overrides:
      generateCode in class Expression
      Parameters:
      currentScope - org.eclipse.jdt.internal.compiler.lookup.BlockScope
      codeStream - org.eclipse.jdt.internal.compiler.codegen.CodeStream
    • suspendVariables

      public void suspendVariables(CodeStream codeStream, BlockScope scope)
    • resumeVariables

      public void resumeVariables(CodeStream codeStream, BlockScope scope)
    • generateOptimizedBoolean

      public abstract void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel)
    • getType

      public TypeReference getType()
    • isPatternTypeCompatible

      protected abstract boolean isPatternTypeCompatible(TypeBinding other, BlockScope scope)
    • dominates

      public abstract boolean dominates(Pattern p)
    • print

      public StringBuilder print(int indent, StringBuilder output)
      Overrides:
      print in class Expression