-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Desugar locals in object comprehension.
Desugar the locals in object comprehensions "traditionally" instead of handling them manually. Object comprehensions allow the locals to depend on the index variable which means that they are separate for each field. It doesn't make sense to treat them as a property of the whole object. Fixes #358.
- Loading branch information
1 parent
6967a29
commit 570101d
Showing
5 changed files
with
39 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"a": "A", | ||
"b": "B" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
local data = { | ||
a: 'A', | ||
b: 'B', | ||
}; | ||
|
||
local process(input) = { | ||
local v = input[k], | ||
[k]: v | ||
for k in std.objectFields(input) | ||
}; | ||
|
||
process(data) |
Empty file.