d2ir: IR Root wip

This commit is contained in:
Anmol Sethi 2023-01-18 03:51:16 -08:00
parent 6e04ebb304
commit 180334a8e1
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
13 changed files with 2902 additions and 3618 deletions

View file

@ -14,21 +14,17 @@ func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) {
} }
func Compile(ast *d2ast.Map) (*Map, error) { func Compile(ast *d2ast.Map) (*Map, error) {
l := &Layer{} m := &Map{}
l.Map = &Map{
parent: l,
}
c := &compiler{} c := &compiler{}
c.compile(l) c.compile(m, ast)
if !c.err.Empty() { if !c.err.Empty() {
return nil, c.err return nil, c.err
} }
return l, nil return m, nil
} }
func (c *compiler) compile(l *Layer) { func (c *compiler) compile(dst *Map, ast *d2ast.Map) {
c.compileMap(l.Map, l.AST) c.compileMap(dst, ast)
} }
func (c *compiler) compileMap(dst *Map, ast *d2ast.Map) { func (c *compiler) compileMap(dst *Map, ast *d2ast.Map) {

View file

@ -38,23 +38,23 @@ func runa(t *testing.T, tca []testCase) {
} }
} }
func compile(t testing.TB, text string) (*d2ir.Layer, error) { func compile(t testing.TB, text string) (*d2ir.Map, error) {
t.Helper() t.Helper()
d2Path := fmt.Sprintf("%v.d2", t.Name()) d2Path := fmt.Sprintf("%v.d2", t.Name())
ast, err := d2parser.Parse(d2Path, strings.NewReader(text), nil) ast, err := d2parser.Parse(d2Path, strings.NewReader(text), nil)
assert.Success(t, err) assert.Success(t, err)
l, err := d2ir.Compile(ast) m, err := d2ir.Compile(ast)
if err != nil { if err != nil {
return nil, err return nil, err
} }
err = diff.TestdataJSON(filepath.Join("..", "testdata", "d2ir", t.Name()), l) err = diff.TestdataJSON(filepath.Join("..", "testdata", "d2ir", t.Name()), m)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return l, nil return m, nil
} }
func assertField(t testing.TB, n d2ir.Node, nfields, nedges int, primary interface{}, ida ...string) *d2ir.Field { func assertField(t testing.TB, n d2ir.Node, nfields, nedges int, primary interface{}, ida ...string) *d2ir.Field {
@ -153,42 +153,42 @@ func testCompileFields(t *testing.T) {
{ {
name: "root", name: "root",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x`) m, err := compile(t, `x`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 1, 0, nil) assertField(t, m, 1, 0, nil)
assertField(t, l, 0, 0, nil, "x") assertField(t, m, 0, 0, nil, "x")
}, },
}, },
{ {
name: "label", name: "label",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x: yes`) m, err := compile(t, `x: yes`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 1, 0, nil) assertField(t, m, 1, 0, nil)
assertField(t, l, 0, 0, "yes", "x") assertField(t, m, 0, 0, "yes", "x")
}, },
}, },
{ {
name: "nested", name: "nested",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x.y: yes`) m, err := compile(t, `x.y: yes`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 2, 0, nil) assertField(t, m, 2, 0, nil)
assertField(t, l, 1, 0, nil, "x") assertField(t, m, 1, 0, nil, "x")
assertField(t, l, 0, 0, "yes", "x", "y") assertField(t, m, 0, 0, "yes", "x", "y")
}, },
}, },
{ {
name: "array", name: "array",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x: [1;2;3;4]`) m, err := compile(t, `x: [1;2;3;4]`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 1, 0, nil) assertField(t, m, 1, 0, nil)
f := assertField(t, l, 0, 0, nil, "x") f := assertField(t, m, 0, 0, nil, "x")
assert.String(t, `[1; 2; 3; 4]`, f.Composite.String()) assert.String(t, `[1; 2; 3; 4]`, f.Composite.String())
}, },
}, },
@ -202,24 +202,24 @@ func testCompileFieldPrimary(t *testing.T) {
{ {
name: "root", name: "root",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x: yes { pqrs }`) m, err := compile(t, `x: yes { pqrs }`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 2, 0, nil) assertField(t, m, 2, 0, nil)
assertField(t, l, 1, 0, "yes", "x") assertField(t, m, 1, 0, "yes", "x")
assertField(t, l, 0, 0, nil, "x", "pqrs") assertField(t, m, 0, 0, nil, "x", "pqrs")
}, },
}, },
{ {
name: "nested", name: "nested",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x.y: yes { pqrs }`) m, err := compile(t, `x.y: yes { pqrs }`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 3, 0, nil) assertField(t, m, 3, 0, nil)
assertField(t, l, 2, 0, nil, "x") assertField(t, m, 2, 0, nil, "x")
assertField(t, l, 1, 0, "yes", "x", "y") assertField(t, m, 1, 0, "yes", "x", "y")
assertField(t, l, 0, 0, nil, "x", "y", "pqrs") assertField(t, m, 0, 0, nil, "x", "y", "pqrs")
}, },
}, },
} }
@ -232,42 +232,42 @@ func testCompileEdges(t *testing.T) {
{ {
name: "root", name: "root",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x -> y`) m, err := compile(t, `x -> y`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 2, 1, nil) assertField(t, m, 2, 1, nil)
assertEdge(t, l, 0, nil, `(x -> y)[0]`) assertEdge(t, m, 0, nil, `(x -> y)[0]`)
assertField(t, l, 0, 0, nil, "x") assertField(t, m, 0, 0, nil, "x")
assertField(t, l, 0, 0, nil, "y") assertField(t, m, 0, 0, nil, "y")
}, },
}, },
{ {
name: "nested", name: "nested",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x.y -> z.p`) m, err := compile(t, `x.y -> z.p`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 4, 1, nil) assertField(t, m, 4, 1, nil)
assertField(t, l, 1, 0, nil, "x") assertField(t, m, 1, 0, nil, "x")
assertField(t, l, 0, 0, nil, "x", "y") assertField(t, m, 0, 0, nil, "x", "y")
assertField(t, l, 1, 0, nil, "z") assertField(t, m, 1, 0, nil, "z")
assertField(t, l, 0, 0, nil, "z", "p") assertField(t, m, 0, 0, nil, "z", "p")
assertEdge(t, l, 0, nil, "(x.y -> z.p)[0]") assertEdge(t, m, 0, nil, "(x.y -> z.p)[0]")
}, },
}, },
{ {
name: "underscore", name: "underscore",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `p: { _.x -> z }`) m, err := compile(t, `p: { _.x -> z }`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 3, 1, nil) assertField(t, m, 3, 1, nil)
assertField(t, l, 0, 0, nil, "x") assertField(t, m, 0, 0, nil, "x")
assertField(t, l, 1, 0, nil, "p") assertField(t, m, 1, 0, nil, "p")
assertEdge(t, l, 0, nil, "(x -> p.z)[0]") assertEdge(t, m, 0, nil, "(x -> p.z)[0]")
}, },
}, },
} }
@ -280,19 +280,19 @@ func testCompileLayers(t *testing.T) {
{ {
name: "root", name: "root",
run: func(t testing.TB) { run: func(t testing.TB) {
l, err := compile(t, `x -> y m, err := compile(t, `x -> y
layers: { layers: {
bingo: { p.q.z } bingo: { p.q.z }
}`) }`)
assert.Success(t, err) assert.Success(t, err)
assertField(t, l, 5, 1, nil) assertField(t, m, 7, 1, nil)
assertEdge(t, l, 0, nil, `(x -> y)[0]`) assertEdge(t, m, 0, nil, `(x -> y)[0]`)
assertField(t, l, 0, 0, nil, "x") assertField(t, m, 0, 0, nil, "x")
assertField(t, l, 0, 0, nil, "y") assertField(t, m, 0, 0, nil, "y")
assertField(t, l, 0, 0, nil, "layers", "bingo") assertField(t, m, 3, 0, nil, "layers", "bingo")
}, },
}, },
} }

View file

@ -630,10 +630,6 @@ func (m *Map) CreateEdge(eid *EdgeID, refctx *RefContext) (*Edge, error) {
return e, nil return e, nil
} }
func (l *Layer) ast() d2ast.Node {
return l.Map.ast()
}
func (s *Scalar) ast() d2ast.Node { func (s *Scalar) ast() d2ast.Node {
return s.Value return s.Value
} }
@ -778,14 +774,17 @@ func ParentField(n Node) *Field {
return nil return nil
} }
func ParentLayer(n Node) *Layer { func ParentLayer(n Node) *Map {
for n.Parent() != nil { for {
n = n.Parent() m := ParentMap(n)
if n_f, ok := n.(*Layer); ok { if m == nil {
return n_f return nil
} }
if m.Layer() {
return m
}
n = m
} }
return nil
} }
func countUnderscores(p []string) int { func countUnderscores(p []string) int {

File diff suppressed because it is too large Load diff

View file

@ -1,12 +1,80 @@
{ {
"ast": { "fields": [
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", {
"nodes": [ "name": "x",
{ "references": [
"map_key": { {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", "string": {
"edges": [ "range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
{ "value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"edges": [
{
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"src": {
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
},
"edge": {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", "range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"src": { "src": {
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2", "range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
@ -43,347 +111,226 @@
}, },
"dst_arrow": ">" "dst_arrow": ">"
} }
], }
"primary": {},
"value": {}
} }
} ]
] },
}, {
"base": { "name": "y",
"fields": [ "references": [
{ {
"name": "x", "string": {
"references": [ "range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
{ "value": [
"string": { {
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1", "string": "y",
"value": [ "raw_string": "y"
{ }
"string": "x", ]
"raw_string": "x" },
"key_path": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
} }
] }
}, ]
"key_path": { },
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2", "context": {
"path": [ "key": {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"edges": [
{ {
"unquoted_string": { "range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1", "src": {
"value": [ "range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
"path": [
{ {
"string": "x", "unquoted_string": {
"raw_string": "x" "range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
} }
] ]
} },
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
} }
] ],
"primary": {},
"value": {}
}, },
"context": { "edge": {
"key": { "range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", "src": {
"edges": [ "range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
"path": [
{ {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", "unquoted_string": {
"src": { "range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2", "value": [
"path": [
{ {
"unquoted_string": { "string": "x",
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1", "raw_string": "x"
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
} }
] ]
}, }
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
} }
], ]
"primary": {},
"value": {}
}, },
"edge": { "src_arrow": "",
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", "dst": {
"src": { "range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2", "path": [
"path": [ {
{ "unquoted_string": {
"unquoted_string": { "range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1", "value": [
"value": [ {
{ "string": "y",
"string": "x", "raw_string": "y"
"raw_string": "x" }
} ]
]
}
} }
] }
}, ]
"src_arrow": "", },
"dst": { "dst_arrow": ">"
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
}
} }
} }
] }
]
}
],
"edges": [
{
"edge_id": {
"src_path": [
"x"
],
"src_arrow": false,
"dst_path": [
"y"
],
"dst_arrow": true,
"index": 0
}, },
{ "references": [
"name": "y", {
"references": [ "context": {
{ "key": {
"string": { "range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6", "edges": [
"value": [
{ {
"string": "y", "range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"raw_string": "y" "src": {
} "range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
] "path": [
},
"key_path": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{ {
"string": "y", "unquoted_string": {
"raw_string": "y" "range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
} }
] ]
} },
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
} }
] ],
"primary": {},
"value": {}
}, },
"context": { "edge": {
"key": { "range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", "src": {
"edges": [ "range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
"path": [
{ {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", "unquoted_string": {
"src": { "range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2", "value": [
"path": [
{ {
"unquoted_string": { "string": "x",
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1", "raw_string": "x"
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
} }
] ]
}, }
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
} }
], ]
"primary": {},
"value": {}
}, },
"edge": { "src_arrow": "",
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6", "dst": {
"src": { "range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2", "path": [
"path": [ {
{ "unquoted_string": {
"unquoted_string": { "range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1", "value": [
"value": [ {
{ "string": "y",
"string": "x", "raw_string": "y"
"raw_string": "x" }
} ]
]
}
} }
] }
}, ]
"src_arrow": "", },
"dst": { "dst_arrow": ">"
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
}
} }
} }
] }
} ]
], }
"edges": [ ]
{
"edge_id": {
"src_path": [
"x"
],
"src_arrow": false,
"dst_path": [
"y"
],
"dst_arrow": true,
"index": 0
},
"references": [
{
"context": {
"key": {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"edges": [
{
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"src": {
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
},
"edge": {
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
"src": {
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "TestCompile/edges/root.d2,0:4:4-0:6:6",
"path": [
{
"unquoted_string": {
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"dst_arrow": ">"
}
}
}
]
}
]
}
} }

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,51 @@
{ {
"ast": { "fields": [
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12", {
"nodes": [ "name": "x",
{ "composite": {
"map_key": { "values": [
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12", {
"key": { "value": {
"range": "TestCompile/fields/array.d2,0:4:4-0:5:5",
"raw": "1",
"value": "1"
}
},
{
"value": {
"range": "TestCompile/fields/array.d2,0:6:6-0:7:7",
"raw": "2",
"value": "2"
}
},
{
"value": {
"range": "TestCompile/fields/array.d2,0:8:8-0:9:9",
"raw": "3",
"value": "3"
}
},
{
"value": {
"range": "TestCompile/fields/array.d2,0:10:10-0:11:11",
"raw": "4",
"value": "4"
}
}
]
},
"references": [
{
"string": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1", "range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"path": [ "path": [
{ {
@ -21,171 +61,67 @@
} }
] ]
}, },
"primary": {}, "context": {
"value": { "key": {
"array": { "range": "TestCompile/fields/array.d2,0:0:0-0:12:12",
"range": "TestCompile/fields/array.d2,0:3:3-0:11:11",
"nodes": [
{
"number": {
"range": "TestCompile/fields/array.d2,0:4:4-0:5:5",
"raw": "1",
"value": "1"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:6:6-0:7:7",
"raw": "2",
"value": "2"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:8:8-0:9:9",
"raw": "3",
"value": "3"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:10:10-0:11:11",
"raw": "4",
"value": "4"
}
}
]
}
}
}
}
]
},
"base": {
"fields": [
{
"name": "x",
"composite": {
"values": [
{
"value": {
"range": "TestCompile/fields/array.d2,0:4:4-0:5:5",
"raw": "1",
"value": "1"
}
},
{
"value": {
"range": "TestCompile/fields/array.d2,0:6:6-0:7:7",
"raw": "2",
"value": "2"
}
},
{
"value": {
"range": "TestCompile/fields/array.d2,0:8:8-0:9:9",
"raw": "3",
"value": "3"
}
},
{
"value": {
"range": "TestCompile/fields/array.d2,0:10:10-0:11:11",
"raw": "4",
"value": "4"
}
}
]
},
"references": [
{
"string": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"context": {
"key": { "key": {
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12", "range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"key": { "path": [
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1", {
"path": [ "unquoted_string": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"array": {
"range": "TestCompile/fields/array.d2,0:3:3-0:11:11",
"nodes": [
{ {
"unquoted_string": { "number": {
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1", "range": "TestCompile/fields/array.d2,0:4:4-0:5:5",
"value": [ "raw": "1",
{ "value": "1"
"string": "x", }
"raw_string": "x" },
} {
] "number": {
"range": "TestCompile/fields/array.d2,0:6:6-0:7:7",
"raw": "2",
"value": "2"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:8:8-0:9:9",
"raw": "3",
"value": "3"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:10:10-0:11:11",
"raw": "4",
"value": "4"
} }
} }
] ]
},
"primary": {},
"value": {
"array": {
"range": "TestCompile/fields/array.d2,0:3:3-0:11:11",
"nodes": [
{
"number": {
"range": "TestCompile/fields/array.d2,0:4:4-0:5:5",
"raw": "1",
"value": "1"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:6:6-0:7:7",
"raw": "2",
"value": "2"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:8:8-0:9:9",
"raw": "3",
"value": "3"
}
},
{
"number": {
"range": "TestCompile/fields/array.d2,0:10:10-0:11:11",
"raw": "4",
"value": "4"
}
}
]
}
} }
}, }
"edge": null },
} "edge": null
} }
] }
} ]
], }
"edges": null ],
} "edges": null
} }

View file

@ -1,11 +1,30 @@
{ {
"ast": { "fields": [
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6", {
"nodes": [ "name": "x",
{ "primary": {
"map_key": { "value": {
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6", "range": "TestCompile/fields/label.d2,0:3:3-0:6:6",
"key": { "value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"references": [
{
"string": {
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1", "range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"path": [ "path": [
{ {
@ -21,102 +40,43 @@
} }
] ]
}, },
"primary": {}, "context": {
"value": { "key": {
"unquoted_string": { "range": "TestCompile/fields/label.d2,0:0:0-0:6:6",
"range": "TestCompile/fields/label.d2,0:3:3-0:6:6",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
}
}
}
]
},
"base": {
"fields": [
{
"name": "x",
"primary": {
"value": {
"range": "TestCompile/fields/label.d2,0:3:3-0:6:6",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"references": [
{
"string": {
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"context": {
"key": { "key": {
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6", "range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"key": { "path": [
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1", {
"path": [ "unquoted_string": {
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/fields/label.d2,0:3:3-0:6:6",
"value": [
{ {
"unquoted_string": { "string": "yes",
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1", "raw_string": "yes"
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
} }
] ]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/fields/label.d2,0:3:3-0:6:6",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
} }
}, }
"edge": null },
} "edge": null
} }
] }
} ]
], }
"edges": null ],
} "edges": null
} }

View file

@ -1,26 +1,25 @@
{ {
"ast": { "fields": [
"range": "TestCompile/fields/nested.d2,0:0:0-0:8:8", {
"nodes": [ "name": "x",
{ "composite": {
"map_key": { "fields": [
"range": "TestCompile/fields/nested.d2,0:0:0-0:8:8", {
"key": { "name": "y",
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3", "primary": {
"path": [ "value": {
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"references": [
{ {
"unquoted_string": { "string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3", "range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [ "value": [
{ {
@ -28,176 +27,8 @@
"raw_string": "y" "raw_string": "y"
} }
] ]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
}
}
}
]
},
"base": {
"fields": [
{
"name": "x",
"composite": {
"fields": [
{
"name": "y",
"primary": {
"value": {
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"references": [
{
"string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
},
"key_path": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:8:8",
"key": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
}
},
"edge": null
}
}
]
}
],
"edges": null
},
"references": [
{
"string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}, },
{ "key_path": {
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:8:8",
"key": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3", "range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
"path": [ "path": [
{ {
@ -224,25 +55,143 @@
} }
] ]
}, },
"primary": {}, "context": {
"value": { "key": {
"unquoted_string": { "range": "TestCompile/fields/nested.d2,0:0:0-0:8:8",
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8", "key": {
"value": [ "range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
{ "path": [
"string": "yes", {
"raw_string": "yes" "unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
} }
] }
} },
"edge": null
}
}
]
}
],
"edges": null
},
"references": [
{
"string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
} }
}, },
"edge": null {
} "unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:8:8",
"key": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
}
},
"edge": null
} }
] }
} ]
], }
"edges": null ],
} "edges": null
} }

View file

@ -1,26 +1,86 @@
{ {
"ast": { "fields": [
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17", {
"nodes": [ "name": "x",
{ "composite": {
"map_key": { "fields": [
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17", {
"key": { "name": "y",
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3", "primary": {
"path": [ "value": {
{ "range": "TestCompile/fields/primary/nested.d2,0:5:5-0:8:8",
"unquoted_string": { "value": [
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1", {
"value": [ "string": "yes",
"raw_string": "yes"
}
]
}
},
"composite": {
"fields": [
{
"name": "pqrs",
"references": [
{ {
"string": "x", "string": {
"raw_string": "x" "range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
},
"key_path": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
},
"edge": null
}
} }
] ]
} }
}, ],
"edges": null
},
"references": [
{ {
"unquoted_string": { "string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3", "range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [ "value": [
{ {
@ -28,295 +88,8 @@
"raw_string": "y" "raw_string": "y"
} }
] ]
}
}
]
},
"primary": {
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"value": {
"map": {
"range": "TestCompile/fields/primary/nested.d2,0:9:9-0:16:16",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
}
}
]
},
"base": {
"fields": [
{
"name": "x",
"composite": {
"fields": [
{
"name": "y",
"primary": {
"value": {
"range": "TestCompile/fields/primary/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"composite": {
"fields": [
{
"name": "pqrs",
"references": [
{
"string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
},
"key_path": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
},
"edge": null
}
}
]
}
],
"edges": null
},
"references": [
{
"string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
},
"key_path": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"value": {
"map": {
"range": "TestCompile/fields/primary/nested.d2,0:9:9-0:16:16",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
},
"edge": null
}
}
]
}
],
"edges": null
},
"references": [
{
"string": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}, },
{ "key_path": {
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3", "range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
"path": [ "path": [
{ {
@ -343,54 +116,201 @@
} }
] ]
}, },
"primary": { "context": {
"unquoted_string": { "key": {
"range": "TestCompile/fields/primary/nested.d2,0:5:5-0:8:8", "range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17",
"value": [ "key": {
{ "range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
"string": "yes", "path": [
"raw_string": "yes" {
} "unquoted_string": {
] "range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
} "value": [
},
"value": {
"map": {
"range": "TestCompile/fields/primary/nested.d2,0:9:9-0:16:16",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{ {
"unquoted_string": { "string": "x",
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15", "raw_string": "x"
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
} }
] ]
}, }
"primary": {}, },
"value": {} {
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
} }
]
},
"primary": {
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
} }
] },
} "value": {
"map": {
"range": "TestCompile/fields/primary/nested.d2,0:9:9-0:16:16",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
},
"edge": null
}
}
]
}
],
"edges": null
},
"references": [
{
"string": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
} }
}, },
"edge": null {
} "unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
},
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
"value": [
{
"string": "y",
"raw_string": "y"
}
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:5:5-0:8:8",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"value": {
"map": {
"range": "TestCompile/fields/primary/nested.d2,0:9:9-0:16:16",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"key": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:16:16",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
},
"edge": null
} }
] }
} ]
], }
"edges": null ],
} "edges": null
} }

View file

@ -1,43 +1,51 @@
{ {
"ast": { "fields": [
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:15:15", {
"nodes": [ "name": "x",
{ "primary": {
"map_key": { "value": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:15:15", "range": "TestCompile/fields/primary/root.d2,0:3:3-0:6:6",
"key": { "value": [
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1", {
"path": [ "string": "yes",
"raw_string": "yes"
}
]
}
},
"composite": {
"fields": [
{
"name": "pqrs",
"references": [
{ {
"unquoted_string": { "string": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1", "range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
"value": [ "value": [
{ {
"string": "x", "string": "pqrs",
"raw_string": "x" "raw_string": "pqrs"
} }
] ]
} },
} "key_path": {
] "range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
}, "path": [
"primary": { {
"unquoted_string": { "unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:3:3-0:6:6", "range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
"value": [ "value": [
{ {
"string": "yes", "string": "pqrs",
"raw_string": "yes" "raw_string": "pqrs"
} }
] ]
} }
}, }
"value": { ]
"map": { },
"range": "TestCompile/fields/primary/root.d2,0:7:7-0:14:14", "context": {
"nodes": [ "key": {
{
"map_key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14", "range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"key": { "key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14", "range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
@ -57,185 +65,108 @@
}, },
"primary": {}, "primary": {},
"value": {} "value": {}
} },
"edge": null
} }
]
}
}
}
}
]
},
"base": {
"fields": [
{
"name": "x",
"primary": {
"value": {
"range": "TestCompile/fields/primary/root.d2,0:3:3-0:6:6",
"value": [
{
"string": "yes",
"raw_string": "yes"
} }
] ]
} }
}, ],
"composite": { "edges": null
"fields": [ },
{ "references": [
"name": "pqrs", {
"references": [ "string": {
{ "range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"string": { "value": [
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13", {
"value": [ "string": "x",
{ "raw_string": "x"
"string": "pqrs", }
"raw_string": "pqrs" ]
} },
] "key_path": {
}, "range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"key_path": { "path": [
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14", {
"path": [ "unquoted_string": {
{ "range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"unquoted_string": { "value": [
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13", {
"value": [ "string": "x",
"raw_string": "x"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:15:15",
"key": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"primary": {
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:3:3-0:6:6",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"value": {
"map": {
"range": "TestCompile/fields/primary/root.d2,0:7:7-0:14:14",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"path": [
{ {
"string": "pqrs", "unquoted_string": {
"raw_string": "pqrs" "range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
} }
] ]
} },
} "primary": {},
] "value": {}
},
"context": {
"key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
},
"edge": null
}
}
]
}
],
"edges": null
},
"references": [
{
"string": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"context": {
"key": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:15:15",
"key": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
} }
} }
] ]
},
"primary": {
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:3:3-0:6:6",
"value": [
{
"string": "yes",
"raw_string": "yes"
}
]
}
},
"value": {
"map": {
"range": "TestCompile/fields/primary/root.d2,0:7:7-0:14:14",
"nodes": [
{
"map_key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"key": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:14:14",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
"value": [
{
"string": "pqrs",
"raw_string": "pqrs"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
} }
}, }
"edge": null },
} "edge": null
} }
] }
} ]
], }
"edges": null ],
} "edges": null
} }

View file

@ -1,11 +1,19 @@
{ {
"ast": { "fields": [
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1", {
"nodes": [ "name": "x",
{ "references": [
"map_key": { {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1", "string": {
"key": { "range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1", "range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"path": [ "path": [
{ {
@ -21,71 +29,33 @@
} }
] ]
}, },
"primary": {}, "context": {
"value": {} "key": {
}
}
]
},
"base": {
"fields": [
{
"name": "x",
"references": [
{
"string": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1", "range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
},
"key_path": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"path": [
{
"unquoted_string": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"value": [
{
"string": "x",
"raw_string": "x"
}
]
}
}
]
},
"context": {
"key": { "key": {
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1", "range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"key": { "path": [
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1", {
"path": [ "unquoted_string": {
{ "range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
"unquoted_string": { "value": [
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1", {
"value": [ "string": "x",
{ "raw_string": "x"
"string": "x", }
"raw_string": "x" ]
}
]
}
} }
] }
}, ]
"primary": {},
"value": {}
}, },
"edge": null "primary": {},
} "value": {}
},
"edge": null
} }
] }
} ]
], }
"edges": null ],
} "edges": null
} }

File diff suppressed because it is too large Load diff