Skip to content

Commit

Permalink
Fix a query compilation error when $ was used as an object entry
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Oct 30, 2023
1 parent bf24453 commit 0efde98
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## next

- Fixed a query compilation error when `$` was used as an object entry, e.g. `{ $, prop: 1 }`

## 1.0.0-beta.9 (October 29, 2023)

- Removed support for a legacy syntax for functions, i.e. `<expr>`
Expand Down
1 change: 1 addition & 0 deletions src/lang/nodes/ObjectEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function compile(node, ctx) {

switch (node.key.type) {
case 'Current':
ctx.put('...null');
return;

case 'Literal':
Expand Down
4 changes: 4 additions & 0 deletions test/lang/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ describe('lang/object', () => {
query('{ $foo: 1 }')(),
{ $foo: 1 }
);
assert.deepEqual(
query('$foo: 42; { $, $foo }')(123),
{ foo: 42 }
);
});

it('computed properties', () => {
Expand Down

0 comments on commit 0efde98

Please sign in to comment.