Skip to main content

Module expr

Module expr 

Source
Expand description

The L2 expression reference (P2-5b): ExprRef and its payload family.

An expression position in the op family holds an ExprRef - a shared arena reference to one of the payloads below, and the enum is total over everything the parser actually produces:

  • ExprRef::Js - the retained oxc AST (the P1-5 parse-once contract): text that parses as one complete TS-dialect expression covering the whole content, carried beside that exact text and its authored span.
  • ExprRef::Foreign - a non-JS expression dialect (charter #28). Type-only until phase 6: the type and its folio spelling exist so the contract is closed, but no dialect implementation ships and no lowering constructs one.
  • ExprRef::Filter - Vue 2 pipe filters ({{ msg | capitalize }}). A dialect expression, not an escape: | here is not bitwise-OR. Constructed only when a Vue 2 dialect lowering admits a chain (P2-9 installment 7); never produced by ExprRef::parse_js_in.
  • ExprRef::Opaque - the escape variant for the retained-None classes P1-5/P1-9 measured, with pessimal documented semantics from day one (the imported LLVM undef/poison rule - see opaque’s module docs for the laws, and docs/davinci/plan/phase-2-records/p2-5b.md for the decision record and the measurement that picked this resolution).

§No equality, on purpose

ExprRef implements neither PartialEq nor Eq. For OpaqueExpr textual equality must never imply semantic equality (pessimal law 4: an opaque expression is not even equal to itself), and offering structural equality on the other variants would make the unsound comparison one match arm away. Consumers that need identity compare the owned folio mirror, which is explicit about what it carries.

§Capability resolution

How a consumer asks questions about an expression (enumerate referenced bindings, classify const-ness, map spans, emit for a target) is the capability contract, resolved once per file and never dyn-dispatched per node (performance guardrail 1).

Re-exports§

pub use capability::ExprDialect;
pub use filter::VueFilterApp;
pub use filter::VueFilterExpr;
pub use foreign::ForeignExpr;
pub use foreign::ForeignFact;
pub use js::JsExpr;
pub use opaque::OpaqueExpr;
pub use opaque::OpaqueReason;

Modules§

capability
The expression capability contract: how a consumer asks questions about an super::ExprRef, and how the answering code is resolved.
filter
vue.filter - Vue 2 pipe-filter expressions ({{ msg | capitalize }}, :id="raw | formatId").
foreign
ForeignExpr - the non-JS expression dialect payload.
js
JsExpr - the retained-AST payload, and the L2 load-path parse site.
opaque
OpaqueExpr - the escape variant, with pessimal semantics written down before the first consumer exists.

Enums§

ExprRef
One expression position’s reference: retained JS AST, foreign dialect, or the classified escape.