Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/operator-ledger.x
Binary operator facts and case projections.
Functions
| Function | Summary |
|---|---|
Compiler.derived_member | Returns the protocol member that derives a comparison operator. |
Compiler.operator_member | Returns the protocol member corresponding to a direct binary operator. |
Symbol.binary_precedence | Returns a binary operator’s precedence level, or zero for any other Symbol. |
Symbol.compound_assignment | Returns the compound assignment for a binary operator, or zero. |
Symbol.compound_operator | Returns the binary operator computed by a compound assignment, or zero. |
Compiler
Compiler.derived_member
Symbol Compiler.derived_member(Compiler c, Symbol op)
Returns the protocol member that derives a comparison operator.
Inequality derives from equal, ordered comparisons derive from compare,
and unsupported operators return zero.
Source: src/operator-ledger.x:89
Compiler.operator_member
Symbol Compiler.operator_member(Compiler c, Symbol op)
Returns the protocol member corresponding to a direct binary operator. Returns zero when the operator has no direct protocol mapping.
Source: src/operator-ledger.x:79
Symbol
Symbol.binary_precedence
int Symbol.binary_precedence(Symbol op)
Returns a binary operator’s precedence level, or zero for any other
Symbol. Levels run from 1 for || to 10 for the multiplicative
operators, so a larger level binds more tightly. === and !== share
the equality level, and in the relational level.
Source: src/operator-ledger.x:59
Symbol.compound_assignment
Symbol Symbol.compound_assignment(Symbol op)
Returns the compound assignment for a binary operator, or zero.
Source: src/operator-ledger.x:71
Symbol.compound_operator
Symbol Symbol.compound_operator(Symbol op)
Returns the binary operator computed by a compound assignment, or zero.
Source: src/operator-ledger.x:65
Design notes
Each row gives the operator, precedence, compound assignment, protocol member, and whether that member derives a comparison. Zero denotes an absent compound assignment or member. Private case projections generate the public operator lookups below.