Skip to content

Commit aa4d611

Browse files
committed
Move Expression to its own module
1 parent 2c206dd commit aa4d611

File tree

11 files changed

+26
-22
lines changed

11 files changed

+26
-22
lines changed

src/language/compiling/semantics/expressions/apply-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { either, type Either } from '../../../../adts.js'
22
import type { ElaborationError } from '../../../errors.js'
33
import type { Molecule } from '../../../parsing.js'
44
import {
5+
isExpression,
56
isFunctionNode,
67
makeUnelaboratedObjectNode,
8+
type Expression,
79
} from '../../../semantics.js'
810
import {
9-
isExpression,
10-
type Expression,
1111
type ExpressionContext,
1212
type KeywordHandler,
1313
} from '../../../semantics/expression-elaboration.js'

src/language/compiling/semantics/expressions/check-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { either, option, type Either } from '../../../../adts.js'
22
import type { ElaborationError } from '../../../errors.js'
33
import type { Molecule } from '../../../parsing.js'
44
import {
5+
isExpression,
56
isFunctionNode,
67
makeUnelaboratedObjectNode,
8+
type Expression,
79
} from '../../../semantics.js'
810
import {
9-
isExpression,
10-
type Expression,
1111
type ExpressionContext,
1212
type KeywordHandler,
1313
} from '../../../semantics/expression-elaboration.js'

src/language/compiling/semantics/expressions/expression-utilities.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ import type { ElaborationError } from '../../../errors.js'
33
import type { Atom, Molecule } from '../../../parsing.js'
44
import {
55
makeUnelaboratedObjectNode,
6+
type Expression,
67
type ObjectNode,
78
} from '../../../semantics.js'
8-
import type {
9-
Expression,
10-
ExpressionContext,
11-
} from '../../../semantics/expression-elaboration.js'
9+
import type { ExpressionContext } from '../../../semantics/expression-elaboration.js'
1210
import { stringifyKeyPathForEndUser } from '../../../semantics/key-path.js'
1311
import { lookupPropertyOfObjectNode } from '../../../semantics/object-node.js'
1412
import {

src/language/compiling/semantics/expressions/function-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import { either, option, type Either } from '../../../../adts.js'
22
import type { ElaborationError } from '../../../errors.js'
33
import type { Atom, Molecule } from '../../../parsing.js'
44
import {
5+
isExpression,
56
makeFunctionNode,
67
makeUnelaboratedObjectNode,
78
serialize,
89
types,
10+
type Expression,
911
type FunctionNode,
1012
} from '../../../semantics.js'
1113
import {
1214
elaborateWithContext,
13-
isExpression,
14-
type Expression,
1515
type ExpressionContext,
1616
type KeywordHandler,
1717
} from '../../../semantics/expression-elaboration.js'

src/language/compiling/semantics/expressions/lookup-expression.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import type {
33
ElaborationError,
44
InvalidExpressionError,
55
} from '../../../errors.js'
6-
import { isFunctionNode, type KeyPath } from '../../../semantics.js'
76
import {
87
isExpression,
8+
isFunctionNode,
99
type Expression,
10+
type KeyPath,
11+
} from '../../../semantics.js'
12+
import {
1013
type ExpressionContext,
1114
type KeywordHandler,
1215
} from '../../../semantics/expression-elaboration.js'

src/language/compiling/semantics/expressions/runtime-expression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { either, type Either } from '../../../../adts.js'
22
import type { ElaborationError } from '../../../errors.js'
33
import {
44
isAssignable,
5+
isExpression,
56
isFunctionNode,
67
makeUnelaboratedObjectNode,
78
replaceAllTypeParametersWithTheirConstraints,
89
types,
10+
type Expression,
911
} from '../../../semantics.js'
1012
import {
11-
isExpression,
12-
type Expression,
1313
type ExpressionContext,
1414
type KeywordHandler,
1515
} from '../../../semantics/expression-elaboration.js'

src/language/compiling/semantics/expressions/todo-expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { either, type Either } from '../../../../adts.js'
22
import type { ElaborationError } from '../../../errors.js'
3+
import type { Expression } from '../../../semantics.js'
34
import {
4-
type Expression,
55
type ExpressionContext,
66
type KeywordHandler,
77
} from '../../../semantics/expression-elaboration.js'

src/language/runtime/keywords.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import {
99
makeObjectNode,
1010
serialize,
1111
types,
12+
type Expression,
1213
type KeywordElaborationResult,
1314
type KeywordModule,
1415
type SemanticGraph,
1516
} from '../semantics.js'
16-
import type { Expression } from '../semantics/expression-elaboration.js'
1717
import { lookupPropertyOfObjectNode } from '../semantics/object-node.js'
1818

1919
const unserializableFunction = () =>

src/language/semantics.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export {
55
type KeywordElaborationResult,
66
type KeywordModule,
77
} from './semantics/expression-elaboration.js'
8+
export { isExpression, type Expression } from './semantics/expression.js'
89
export {
910
isFunctionNode,
1011
makeFunctionNode,

src/language/semantics/expression-elaboration.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
type KeyPath,
1010
type ObjectNode,
1111
} from '../semantics.js'
12+
import type { Expression } from './expression.js'
1213
import {
1314
extractStringValueIfPossible,
1415
updateValueAtKeyPathInSemanticGraph,
@@ -19,13 +20,6 @@ declare const _elaborated: unique symbol
1920
type Elaborated = { readonly [_elaborated]: true }
2021
export type ElaboratedSemanticGraph = WithPhantomData<SemanticGraph, Elaborated>
2122

22-
export type Expression = ObjectNode & {
23-
readonly 0: `@${string}`
24-
}
25-
26-
export const isExpression = (node: SemanticGraph): node is Expression =>
27-
typeof node === 'object' && typeof node[0] === 'string' && node[0][0] === '@'
28-
2923
export type ExpressionContext = {
3024
readonly program: SemanticGraph
3125
readonly location: KeyPath

0 commit comments

Comments
 (0)