Skip to content

Commit 7cc6c66

Browse files
committed
Support dotted paths in @lookup
1 parent 60e8800 commit 7cc6c66

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/end-to-end.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ testCases(endToEnd, code => code)('end-to-end tests', [
180180
],
181181
[
182182
`{@runtime context =>
183-
:{context environment lookup}(PATH)
183+
:context.environment.lookup(PATH)
184184
}`,
185185
output => {
186186
if (either.isLeft(output)) {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ export const readLookupExpression = (
5151
})
5252
} else {
5353
const canonicalizedQuery =
54-
typeof query === 'string' ? makeObjectNode({ 0: query }) : query
54+
typeof query === 'string'
55+
? makeObjectNode(
56+
Object.fromEntries(
57+
query.split('.').map((key, index) => [index, key]),
58+
),
59+
)
60+
: query
5561

5662
return either.map(
5763
keyPathFromObjectNode(canonicalizedQuery),

0 commit comments

Comments
 (0)