d2ir: IR Root wip
This commit is contained in:
parent
6e04ebb304
commit
180334a8e1
13 changed files with 2902 additions and 3618 deletions
|
|
@ -14,21 +14,17 @@ func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) {
|
|||
}
|
||||
|
||||
func Compile(ast *d2ast.Map) (*Map, error) {
|
||||
l := &Layer{}
|
||||
l.Map = &Map{
|
||||
parent: l,
|
||||
}
|
||||
|
||||
m := &Map{}
|
||||
c := &compiler{}
|
||||
c.compile(l)
|
||||
c.compile(m, ast)
|
||||
if !c.err.Empty() {
|
||||
return nil, c.err
|
||||
}
|
||||
return l, nil
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *compiler) compile(l *Layer) {
|
||||
c.compileMap(l.Map, l.AST)
|
||||
func (c *compiler) compile(dst *Map, ast *d2ast.Map) {
|
||||
c.compileMap(dst, ast)
|
||||
}
|
||||
|
||||
func (c *compiler) compileMap(dst *Map, ast *d2ast.Map) {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
d2Path := fmt.Sprintf("%v.d2", t.Name())
|
||||
ast, err := d2parser.Parse(d2Path, strings.NewReader(text), nil)
|
||||
assert.Success(t, err)
|
||||
|
||||
l, err := d2ir.Compile(ast)
|
||||
m, err := d2ir.Compile(ast)
|
||||
if err != nil {
|
||||
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 {
|
||||
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 {
|
||||
|
|
@ -153,42 +153,42 @@ func testCompileFields(t *testing.T) {
|
|||
{
|
||||
name: "root",
|
||||
run: func(t testing.TB) {
|
||||
l, err := compile(t, `x`)
|
||||
m, err := compile(t, `x`)
|
||||
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",
|
||||
run: func(t testing.TB) {
|
||||
l, err := compile(t, `x: yes`)
|
||||
m, err := compile(t, `x: yes`)
|
||||
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",
|
||||
run: func(t testing.TB) {
|
||||
l, err := compile(t, `x.y: yes`)
|
||||
m, err := compile(t, `x.y: yes`)
|
||||
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, l, 0, 0, "yes", "x", "y")
|
||||
assertField(t, m, 1, 0, nil, "x")
|
||||
assertField(t, m, 0, 0, "yes", "x", "y")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "array",
|
||||
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)
|
||||
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())
|
||||
},
|
||||
},
|
||||
|
|
@ -202,24 +202,24 @@ func testCompileFieldPrimary(t *testing.T) {
|
|||
{
|
||||
name: "root",
|
||||
run: func(t testing.TB) {
|
||||
l, err := compile(t, `x: yes { pqrs }`)
|
||||
m, err := compile(t, `x: yes { pqrs }`)
|
||||
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, l, 0, 0, nil, "x", "pqrs")
|
||||
assertField(t, m, 1, 0, "yes", "x")
|
||||
assertField(t, m, 0, 0, nil, "x", "pqrs")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "nested",
|
||||
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)
|
||||
assertField(t, l, 3, 0, nil)
|
||||
assertField(t, m, 3, 0, nil)
|
||||
|
||||
assertField(t, l, 2, 0, nil, "x")
|
||||
assertField(t, l, 1, 0, "yes", "x", "y")
|
||||
assertField(t, l, 0, 0, nil, "x", "y", "pqrs")
|
||||
assertField(t, m, 2, 0, nil, "x")
|
||||
assertField(t, m, 1, 0, "yes", "x", "y")
|
||||
assertField(t, m, 0, 0, nil, "x", "y", "pqrs")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -232,42 +232,42 @@ func testCompileEdges(t *testing.T) {
|
|||
{
|
||||
name: "root",
|
||||
run: func(t testing.TB) {
|
||||
l, err := compile(t, `x -> y`)
|
||||
m, err := compile(t, `x -> y`)
|
||||
assert.Success(t, err)
|
||||
assertField(t, l, 2, 1, nil)
|
||||
assertEdge(t, l, 0, nil, `(x -> y)[0]`)
|
||||
assertField(t, m, 2, 1, nil)
|
||||
assertEdge(t, m, 0, nil, `(x -> y)[0]`)
|
||||
|
||||
assertField(t, l, 0, 0, nil, "x")
|
||||
assertField(t, l, 0, 0, nil, "y")
|
||||
assertField(t, m, 0, 0, nil, "x")
|
||||
assertField(t, m, 0, 0, nil, "y")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "nested",
|
||||
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)
|
||||
assertField(t, l, 4, 1, nil)
|
||||
assertField(t, m, 4, 1, nil)
|
||||
|
||||
assertField(t, l, 1, 0, nil, "x")
|
||||
assertField(t, l, 0, 0, nil, "x", "y")
|
||||
assertField(t, m, 1, 0, nil, "x")
|
||||
assertField(t, m, 0, 0, nil, "x", "y")
|
||||
|
||||
assertField(t, l, 1, 0, nil, "z")
|
||||
assertField(t, l, 0, 0, nil, "z", "p")
|
||||
assertField(t, m, 1, 0, nil, "z")
|
||||
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",
|
||||
run: func(t testing.TB) {
|
||||
l, err := compile(t, `p: { _.x -> z }`)
|
||||
m, err := compile(t, `p: { _.x -> z }`)
|
||||
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, l, 1, 0, nil, "p")
|
||||
assertField(t, m, 0, 0, nil, "x")
|
||||
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",
|
||||
run: func(t testing.TB) {
|
||||
l, err := compile(t, `x -> y
|
||||
m, err := compile(t, `x -> y
|
||||
layers: {
|
||||
bingo: { p.q.z }
|
||||
}`)
|
||||
assert.Success(t, err)
|
||||
|
||||
assertField(t, l, 5, 1, nil)
|
||||
assertEdge(t, l, 0, nil, `(x -> y)[0]`)
|
||||
assertField(t, m, 7, 1, nil)
|
||||
assertEdge(t, m, 0, nil, `(x -> y)[0]`)
|
||||
|
||||
assertField(t, l, 0, 0, nil, "x")
|
||||
assertField(t, l, 0, 0, nil, "y")
|
||||
assertField(t, m, 0, 0, nil, "x")
|
||||
assertField(t, m, 0, 0, nil, "y")
|
||||
|
||||
assertField(t, l, 0, 0, nil, "layers", "bingo")
|
||||
assertField(t, m, 3, 0, nil, "layers", "bingo")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
19
d2ir/d2ir.go
19
d2ir/d2ir.go
|
|
@ -630,10 +630,6 @@ func (m *Map) CreateEdge(eid *EdgeID, refctx *RefContext) (*Edge, error) {
|
|||
return e, nil
|
||||
}
|
||||
|
||||
func (l *Layer) ast() d2ast.Node {
|
||||
return l.Map.ast()
|
||||
}
|
||||
|
||||
func (s *Scalar) ast() d2ast.Node {
|
||||
return s.Value
|
||||
}
|
||||
|
|
@ -778,14 +774,17 @@ func ParentField(n Node) *Field {
|
|||
return nil
|
||||
}
|
||||
|
||||
func ParentLayer(n Node) *Layer {
|
||||
for n.Parent() != nil {
|
||||
n = n.Parent()
|
||||
if n_f, ok := n.(*Layer); ok {
|
||||
return n_f
|
||||
func ParentLayer(n Node) *Map {
|
||||
for {
|
||||
m := ParentMap(n)
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
if m.Layer() {
|
||||
return m
|
||||
}
|
||||
n = m
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func countUnderscores(p []string) int {
|
||||
|
|
|
|||
1473
testdata/d2ir/TestCompile/edges/nested.exp.json
generated
vendored
1473
testdata/d2ir/TestCompile/edges/nested.exp.json
generated
vendored
File diff suppressed because it is too large
Load diff
583
testdata/d2ir/TestCompile/edges/root.exp.json
generated
vendored
583
testdata/d2ir/TestCompile/edges/root.exp.json
generated
vendored
|
|
@ -1,12 +1,80 @@
|
|||
{
|
||||
"ast": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
|
||||
"edges": [
|
||||
{
|
||||
"fields": [
|
||||
{
|
||||
"name": "x",
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"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",
|
||||
"src": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
|
||||
|
|
@ -43,347 +111,226 @@
|
|||
},
|
||||
"dst_arrow": ">"
|
||||
}
|
||||
],
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"base": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "x",
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "y",
|
||||
"references": [
|
||||
{
|
||||
"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: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",
|
||||
"path": [
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"key": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
|
||||
"edges": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
|
||||
"src": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
|
||||
"path": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
"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": {}
|
||||
},
|
||||
"context": {
|
||||
"key": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
|
||||
"edges": [
|
||||
"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": [
|
||||
{
|
||||
"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": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": ">"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dst_arrow": ">"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"edge_id": {
|
||||
"src_path": [
|
||||
"x"
|
||||
],
|
||||
"src_arrow": false,
|
||||
"dst_path": [
|
||||
"y"
|
||||
],
|
||||
"dst_arrow": true,
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"name": "y",
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/edges/root.d2,0:5:5-0:6:6",
|
||||
"value": [
|
||||
"references": [
|
||||
{
|
||||
"context": {
|
||||
"key": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
|
||||
"edges": [
|
||||
{
|
||||
"string": "y",
|
||||
"raw_string": "y"
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": [
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
|
||||
"src": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:2:2",
|
||||
"path": [
|
||||
{
|
||||
"string": "y",
|
||||
"raw_string": "y"
|
||||
"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": {}
|
||||
},
|
||||
"context": {
|
||||
"key": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:6:6",
|
||||
"edges": [
|
||||
"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": [
|
||||
{
|
||||
"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": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/edges/root.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": ">"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": ">"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
943
testdata/d2ir/TestCompile/edges/underscore.exp.json
generated
vendored
943
testdata/d2ir/TestCompile/edges/underscore.exp.json
generated
vendored
File diff suppressed because it is too large
Load diff
270
testdata/d2ir/TestCompile/fields/array.exp.json
generated
vendored
270
testdata/d2ir/TestCompile/fields/array.exp.json
generated
vendored
|
|
@ -1,11 +1,51 @@
|
|||
{
|
||||
"ast": {
|
||||
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12",
|
||||
"key": {
|
||||
"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": [
|
||||
{
|
||||
|
|
@ -21,171 +61,67 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": {
|
||||
"context": {
|
||||
"key": {
|
||||
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12",
|
||||
"key": {
|
||||
"range": "TestCompile/fields/array.d2,0:0:0-0:12:12",
|
||||
"key": {
|
||||
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
|
||||
"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": {
|
||||
"range": "TestCompile/fields/array.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
158
testdata/d2ir/TestCompile/fields/label.exp.json
generated
vendored
158
testdata/d2ir/TestCompile/fields/label.exp.json
generated
vendored
|
|
@ -1,11 +1,30 @@
|
|||
{
|
||||
"ast": {
|
||||
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6",
|
||||
"key": {
|
||||
"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": [
|
||||
{
|
||||
|
|
@ -21,102 +40,43 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"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": {
|
||||
"context": {
|
||||
"key": {
|
||||
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6",
|
||||
"key": {
|
||||
"range": "TestCompile/fields/label.d2,0:0:0-0:6:6",
|
||||
"key": {
|
||||
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
|
||||
"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": {
|
||||
"range": "TestCompile/fields/label.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
"string": "yes",
|
||||
"raw_string": "yes"
|
||||
}
|
||||
]
|
||||
},
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
363
testdata/d2ir/TestCompile/fields/nested.exp.json
generated
vendored
363
testdata/d2ir/TestCompile/fields/nested.exp.json
generated
vendored
|
|
@ -1,26 +1,25 @@
|
|||
{
|
||||
"ast": {
|
||||
"range": "TestCompile/fields/nested.d2,0:0:0-0:8:8",
|
||||
"nodes": [
|
||||
{
|
||||
"map_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": [
|
||||
"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": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/fields/nested.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"unquoted_string": {
|
||||
"string": {
|
||||
"range": "TestCompile/fields/nested.d2,0:2:2-0:3:3",
|
||||
"value": [
|
||||
{
|
||||
|
|
@ -28,176 +27,8 @@
|
|||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"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": {
|
||||
"key_path": {
|
||||
"range": "TestCompile/fields/nested.d2,0:0:0-0:3:3",
|
||||
"path": [
|
||||
{
|
||||
|
|
@ -224,25 +55,143 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/fields/nested.d2,0:5:5-0:8:8",
|
||||
"value": [
|
||||
{
|
||||
"string": "yes",
|
||||
"raw_string": "yes"
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
614
testdata/d2ir/TestCompile/fields/primary/nested.exp.json
generated
vendored
614
testdata/d2ir/TestCompile/fields/primary/nested.exp.json
generated
vendored
|
|
@ -1,26 +1,86 @@
|
|||
{
|
||||
"ast": {
|
||||
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:17:17",
|
||||
"nodes": [
|
||||
{
|
||||
"map_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": [
|
||||
"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": "x",
|
||||
"raw_string": "x"
|
||||
"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": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"string": {
|
||||
"range": "TestCompile/fields/primary/nested.d2,0:2:2-0:3:3",
|
||||
"value": [
|
||||
{
|
||||
|
|
@ -28,295 +88,8 @@
|
|||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"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": {
|
||||
"key_path": {
|
||||
"range": "TestCompile/fields/primary/nested.d2,0:0:0-0:3:3",
|
||||
"path": [
|
||||
{
|
||||
|
|
@ -343,54 +116,201 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"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": [
|
||||
"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": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/fields/primary/nested.d2,0:11:11-0:15:15",
|
||||
"value": [
|
||||
{
|
||||
"string": "pqrs",
|
||||
"raw_string": "pqrs"
|
||||
}
|
||||
]
|
||||
}
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
},
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
337
testdata/d2ir/TestCompile/fields/primary/root.exp.json
generated
vendored
337
testdata/d2ir/TestCompile/fields/primary/root.exp.json
generated
vendored
|
|
@ -1,43 +1,51 @@
|
|||
{
|
||||
"ast": {
|
||||
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:15:15",
|
||||
"nodes": [
|
||||
{
|
||||
"map_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": [
|
||||
"fields": [
|
||||
{
|
||||
"name": "x",
|
||||
"primary": {
|
||||
"value": {
|
||||
"range": "TestCompile/fields/primary/root.d2,0:3:3-0:6:6",
|
||||
"value": [
|
||||
{
|
||||
"string": "yes",
|
||||
"raw_string": "yes"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"composite": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "pqrs",
|
||||
"references": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/fields/primary/root.d2,0:0:0-0:1:1",
|
||||
"string": {
|
||||
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
"string": "pqrs",
|
||||
"raw_string": "pqrs"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": {
|
||||
},
|
||||
"key_path": {
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"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",
|
||||
|
|
@ -57,185 +65,108 @@
|
|||
},
|
||||
"primary": {},
|
||||
"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": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "pqrs",
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
|
||||
"value": [
|
||||
{
|
||||
"string": "pqrs",
|
||||
"raw_string": "pqrs"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_path": {
|
||||
"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": [
|
||||
],
|
||||
"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": [
|
||||
{
|
||||
"string": "pqrs",
|
||||
"raw_string": "pqrs"
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/fields/primary/root.d2,0:9:9-0:13:13",
|
||||
"value": [
|
||||
{
|
||||
"string": "pqrs",
|
||||
"raw_string": "pqrs"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": {},
|
||||
"value": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"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
|
||||
}
|
||||
|
|
|
|||
106
testdata/d2ir/TestCompile/fields/root.exp.json
generated
vendored
106
testdata/d2ir/TestCompile/fields/root.exp.json
generated
vendored
|
|
@ -1,11 +1,19 @@
|
|||
{
|
||||
"ast": {
|
||||
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
|
||||
"nodes": [
|
||||
{
|
||||
"map_key": {
|
||||
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
|
||||
"key": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "x",
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"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": [
|
||||
{
|
||||
|
|
@ -21,71 +29,33 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"base": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "x",
|
||||
"references": [
|
||||
{
|
||||
"string": {
|
||||
"context": {
|
||||
"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",
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"context": {
|
||||
"key": {
|
||||
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
|
||||
"key": {
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
"path": [
|
||||
{
|
||||
"unquoted_string": {
|
||||
"range": "TestCompile/fields/root.d2,0:0:0-0:1:1",
|
||||
"value": [
|
||||
{
|
||||
"string": "x",
|
||||
"raw_string": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"primary": {},
|
||||
"value": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
"edge": null
|
||||
}
|
||||
"primary": {},
|
||||
"value": {}
|
||||
},
|
||||
"edge": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": null
|
||||
}
|
||||
|
|
|
|||
1542
testdata/d2ir/TestCompile/layer/root.exp.json
generated
vendored
1542
testdata/d2ir/TestCompile/layer/root.exp.json
generated
vendored
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue