class RewriteBooleans extends Phase

For SQL back-ends which do not support real boolean types for fields and general expressions but which do have special boolean expressions and operators, this phase injects conversions between fake and real boolean values.

The default for booleans in the AST is to use the fake type (mapped to a numeric type by the profile). There are specific places where a real boolean (that can be used in boolean expressions) is required or produced, so we inject a call to ToRealBoolean or ToFakeBoolean as needed.

Source
RewriteBooleans.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RewriteBooleans
  2. Phase
  3. Logging
  4. Function1
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new RewriteBooleans()

Type Members

  1. abstract type State

    The immutable state of the phase that can also be accessed by other phases.

    The immutable state of the phase that can also be accessed by other phases.

    Definition Classes
    Phase

Value Members

  1. def andThen[A](g: (CompilerState) => A): (CompilerState) => A
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  2. def apply(state: CompilerState): CompilerState

    Run the phase

    Run the phase

    Definition Classes
    RewriteBooleansPhase → Function1
  3. def compose[A](g: (A) => CompilerState): (A) => CompilerState
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  4. def isBooleanLike(t: Type): Boolean

    Check if a type is equivalent to the Scala Boolean type or a (possibly nested) Option of that type.

  5. val name: String

    The unique name of the phase

    The unique name of the phase

    Definition Classes
    RewriteBooleansPhase
  6. def rewrite(n: Node): Node

    Rewrite a single Node.

    Rewrite a single Node. This method can be overridden in subclasses to change the situations in which conversions are applied.

  7. def rewriteRec(n: Node): Node
  8. def toFake(n: Node): Node

    Create a conversion to a fake boolean, cancelling out an existing conversion to a real boolean.

  9. def toReal(n: Node): Node

    Create a conversion to a real boolean, cancelling out an existing conversion to a fake boolean.

  10. def toString(): String
    Definition Classes
    Function1 → AnyRef → Any