mirror of
https://github.com/google/go-jsonnet.git
synced 2025-12-24 02:21:06 +01:00
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.
13 lines
148 B
Jsonnet
13 lines
148 B
Jsonnet
local data = {
|
|
a: 'A',
|
|
b: 'B',
|
|
};
|
|
|
|
local process(input) = {
|
|
local v = input[k],
|
|
[k]: v
|
|
for k in std.objectFields(input)
|
|
};
|
|
|
|
process(data)
|