source
API reference for @effx/compiler/lift/source
source.ts overview
Exports Grouped by Category
- utils
- Finding
- Finding (type alias)
- FindingKind
- FindingKind (type alias)
- ImportBinding
- ImportBinding (type alias)
- SourceFileRecord
- SourceFileRecord (type alias)
- SourceImport
- SourceImport (type alias)
- SourcePosition
- SourcePosition (type alias)
- SourceRange
- SourceRange (type alias)
- TermPath
- TermPath (type alias)
- TermSlot
- TermSlot (type alias)
- TermSpan
- TermSpan (type alias)
- locationOf
utils
Finding
One node the frontend could not lower: its kind, how the source names the construct, and where it is.
enclosingCall is the callee of the innermost enclosing call whose callee lowered to an exported symbol:
a whole call cannot be a term when one argument is unlowerable, and this keeps "a registered helper with a
non-literal argument" distinguishable from "an unregistered helper" without ever guessing.
Signature
declare const Finding: Schema.Struct<{
readonly kind: Schema.Literals<
readonly ["spread", "computed-key", "non-literal", "local-reference", "closure", "unresolved", "unsupported-syntax"]
>
readonly construct: Schema.String
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
readonly end: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
}>
readonly enclosingCall: Schema.optionalKey<
Schema.Struct<{
readonly callee: Schema.Struct<{
readonly module: Schema.String
readonly export: Schema.String
readonly member: Schema.optionalKey<Schema.String>
}>
}>
>
}>Finding (type alias)
Signature
type Finding = typeof Finding.TypeFindingKind
The closed syntactic reasons the frontend cannot lower a node into a Term. The frontend classifies
syntax only; the core decides which diagnostic a finding becomes from the semantic position it sits in.
Signature
declare const FindingKind: Schema.Literals<
readonly ["spread", "computed-key", "non-literal", "local-reference", "closure", "unresolved", "unsupported-syntax"]
>FindingKind (type alias)
Signature
type FindingKind = typeof FindingKind.TypeImportBinding
An import binding of a source file: the local name and the symbol it resolves to.
Signature
declare const ImportBinding: Schema.Struct<{
readonly local: Schema.String
readonly ref: Schema.Struct<{
readonly module: Schema.String
readonly export: Schema.String
readonly member: Schema.optionalKey<Schema.String>
}>
}>ImportBinding (type alias)
Signature
type ImportBinding = typeof ImportBinding.TypeSourceFileRecord
One analyzed source file without its text: identity, hash, exports, top-level names, import bindings, module edges, import insertion point and the exact UTF-16 end of the hashed source.
Signature
declare const SourceFileRecord: Schema.Struct<{
readonly file: Schema.String
readonly module: Schema.String
readonly idPath: Schema.String
readonly sha256: Schema.String
readonly exports: Schema.$Array<Schema.String>
readonly topLevel: Schema.$Array<Schema.String>
readonly imports: Schema.$Array<
Schema.TaggedUnion<{
readonly Resolved: Schema.TaggedStruct<
"Resolved",
{
readonly specifier: Schema.String
readonly module: Schema.String
readonly kind: Schema.Literals<readonly ["value", "type"]>
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
}>
readonly bindings: Schema.$Array<
Schema.Struct<{
readonly local: Schema.String
readonly ref: Schema.Struct<{
readonly module: Schema.String
readonly export: Schema.String
readonly member: Schema.optionalKey<Schema.String>
}>
}>
>
}
>
readonly Unresolved: Schema.TaggedStruct<
"Unresolved",
{
readonly specifier: Schema.String
readonly kind: Schema.Literals<readonly ["value", "type", "dynamic"]>
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
}>
readonly bindings: Schema.$Array<
Schema.Struct<{
readonly local: Schema.String
readonly ref: Schema.Struct<{
readonly module: Schema.String
readonly export: Schema.String
readonly member: Schema.optionalKey<Schema.String>
}>
}>
>
}
>
}>
>
readonly importsEnd: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
}>SourceFileRecord (type alias)
Signature
type SourceFileRecord = typeof SourceFileRecord.TypeSourceImport
One import/re-export edge. Resolved specifier is the literal value passed to TS resolution; module is its canonical target.
Signature
declare const SourceImport: Schema.TaggedUnion<{
readonly Resolved: Schema.TaggedStruct<
"Resolved",
{
readonly specifier: Schema.String
readonly module: Schema.String
readonly kind: Schema.Literals<readonly ["value", "type"]>
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
}>
readonly bindings: Schema.$Array<
Schema.Struct<{
readonly local: Schema.String
readonly ref: Schema.Struct<{
readonly module: Schema.String
readonly export: Schema.String
readonly member: Schema.optionalKey<Schema.String>
}>
}>
>
}
>
readonly Unresolved: Schema.TaggedStruct<
"Unresolved",
{
readonly specifier: Schema.String
readonly kind: Schema.Literals<readonly ["value", "type", "dynamic"]>
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
}>
readonly bindings: Schema.$Array<
Schema.Struct<{
readonly local: Schema.String
readonly ref: Schema.Struct<{
readonly module: Schema.String
readonly export: Schema.String
readonly member: Schema.optionalKey<Schema.String>
}>
}>
>
}
>
}>SourceImport (type alias)
Signature
type SourceImport = typeof SourceImport.TypeSourcePosition
A point in a source file: the numeric offset orders and edits; line/col serve diagnostics.
Signature
declare const SourcePosition: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>SourcePosition (type alias)
Signature
type SourcePosition = typeof SourcePosition.TypeSourceRange
A half-open source range [start, end) inside one file.
Signature
declare const SourceRange: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
readonly end: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
}>SourceRange (type alias)
Signature
type SourceRange = typeof SourceRange.TypeTermPath
A path through a Term value: the property names and array indices that navigate from the root
term to a node (["args", 1], ["calls", 0, "args", 2], ["entries", 3, "value"]).
Signature
declare const TermPath: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>TermPath (type alias)
Signature
type TermPath = typeof TermPath.TypeTermSlot
One expression position of the model. Lowered is complete: every node of term was lowered, and spans
gives the range of nodes the core may need to locate a cause (call nodes, callees and arguments at least;
the core falls back to the nearest ancestor span and finally to range). Unlowered carries no term, only
the findings that prevented it, so a partial term is unrepresentable.
Signature
declare const TermSlot: Schema.TaggedUnion<{
readonly Lowered: Schema.TaggedStruct<
"Lowered",
{
readonly term: Schema.Codec<Term, Term, never, never>
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
}>
readonly spans: Schema.$Array<
Schema.Struct<{
readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
}>
}>
>
}
>
readonly Unlowered: Schema.TaggedStruct<
"Unlowered",
{
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
}>
readonly findings: Schema.NonEmptyArray<
Schema.Struct<{
readonly kind: Schema.Literals<
readonly [
"spread",
"computed-key",
"non-literal",
"local-reference",
"closure",
"unresolved",
"unsupported-syntax"
]
>
readonly construct: Schema.String
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
readonly end: Schema.Struct<{
readonly offset: Schema.Int
readonly line: Schema.Int
readonly col: Schema.Int
}>
}>
readonly enclosingCall: Schema.optionalKey<
Schema.Struct<{
readonly callee: Schema.Struct<{
readonly module: Schema.String
readonly export: Schema.String
readonly member: Schema.optionalKey<Schema.String>
}>
}>
>
}>
>
}
>
}>TermSlot (type alias)
Signature
type TermSlot = typeof TermSlot.TypeTermSpan
The source range of one node inside a lowered term.
Signature
declare const TermSpan: Schema.Struct<{
readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>
readonly range: Schema.Struct<{
readonly file: Schema.String
readonly start: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
readonly end: Schema.Struct<{ readonly offset: Schema.Int; readonly line: Schema.Int; readonly col: Schema.Int }>
}>
}>TermSpan (type alias)
Signature
type TermSpan = typeof TermSpan.TypelocationOf
The diagnostic Location of a range: its start.
Signature
declare const locationOf: (range: SourceRange) => Location