Skip to content

Commit

Permalink
fix: empty object (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-gorules authored Sep 10, 2024
1 parent 719d43a commit a903982
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/expression/src/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,12 @@ impl<'arena, 'token_ref, Flavor> Parser<'arena, 'token_ref, Flavor> {
F: Fn() -> ParserResult<&'arena Node<'arena>>,
{
self.expect(TokenKind::Bracket(Bracket::LeftCurlyBracket))?;

let mut key_value_pairs = BumpVec::new_in(self.bump);
if let TokenKind::Bracket(Bracket::RightCurlyBracket) = self.current().kind {
self.next()?;
return Ok(self.node(Node::Object(key_value_pairs.into_bump_slice())));
}

loop {
let key = self.object_key(&expression_parser)?;
Expand Down
1 change: 1 addition & 0 deletions core/expression/tests/data/standard.csv
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ keys(customer);{"customer": {"firstName": "John"}};["firstName"]
keys(customer);{"customer": {"lastName": "Doe"}};["lastName"]
values(customer);{"customer": {"firstName": "John"}};["John"]
values(customer);{"customer": {"lastName": "Doe"}};["Doe"]
{};;{}

# Nullish coalescing
null ?? 'hello';;'hello'
Expand Down

0 comments on commit a903982

Please sign in to comment.