d2ir: IR Root wip
This commit is contained in:
parent
25ea89fea3
commit
5741e0a4f9
11 changed files with 729 additions and 57 deletions
|
|
@ -43,18 +43,22 @@ func (c *compiler) compileMap(dst *Map, ast *d2ast.Map) {
|
||||||
for _, n := range ast.Nodes {
|
for _, n := range ast.Nodes {
|
||||||
switch {
|
switch {
|
||||||
case n.MapKey != nil:
|
case n.MapKey != nil:
|
||||||
c.compileKey(dst, n.MapKey)
|
c.compileKey(dst, &RefContext{
|
||||||
|
Key: n.MapKey,
|
||||||
|
Scope: ast,
|
||||||
|
})
|
||||||
case n.Substitution != nil:
|
case n.Substitution != nil:
|
||||||
panic("TODO")
|
panic("TODO")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *compiler) compileKey(dst *Map, k *d2ast.Key) {
|
func (c *compiler) compileKey(dst *Map, refctx *RefContext) {
|
||||||
if len(k.Edges) == 0 {
|
if len(refctx.Key.Edges) == 0 {
|
||||||
c.compileField(dst, k)
|
c.compileField(dst, refctx.Key)
|
||||||
|
dst.appendFieldReferences(0, refctx.Key.Key, refctx)
|
||||||
} else {
|
} else {
|
||||||
c.compileEdges(dst, k)
|
c.compileEdges(dst, refctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,15 +82,14 @@ func (c *compiler) compileField(dst *Map, k *d2ast.Key) {
|
||||||
c.compileArray(a, k.Value.Array)
|
c.compileArray(a, k.Value.Array)
|
||||||
f.Composite = a
|
f.Composite = a
|
||||||
} else if k.Value.Map != nil {
|
} else if k.Value.Map != nil {
|
||||||
if f_m, ok := f.Composite.(*Map); ok {
|
f_m := ToMap(f)
|
||||||
c.compileMap(f_m, k.Value.Map)
|
if f_m == nil {
|
||||||
} else {
|
f_m = &Map{
|
||||||
m := &Map{
|
|
||||||
parent: f,
|
parent: f,
|
||||||
}
|
}
|
||||||
c.compileMap(m, k.Value.Map)
|
f.Composite = f_m
|
||||||
f.Composite = m
|
|
||||||
}
|
}
|
||||||
|
c.compileMap(f_m, k.Value.Map)
|
||||||
} else if k.Value.ScalarBox().Unbox() != nil {
|
} else if k.Value.ScalarBox().Unbox() != nil {
|
||||||
f.Primary = &Scalar{
|
f.Primary = &Scalar{
|
||||||
parent: f,
|
parent: f,
|
||||||
|
|
@ -95,79 +98,88 @@ func (c *compiler) compileField(dst *Map, k *d2ast.Key) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *compiler) compileEdges(dst *Map, k *d2ast.Key) {
|
func (c *compiler) compileEdges(dst *Map, refctx *RefContext) {
|
||||||
if k.Key != nil && len(k.Key.Path) > 0 {
|
if refctx.Key.Key != nil && len(refctx.Key.Key.Path) > 0 {
|
||||||
f, err := dst.EnsureField(d2format.KeyPath(k.Key))
|
f, err := dst.EnsureField(d2format.KeyPath(refctx.Key.Key))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.errorf(k, err.Error())
|
c.errorf(refctx.Key.Key, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if f_m, ok := f.Composite.(*Map); ok {
|
dst.appendFieldReferences(0, refctx.Key.Key, refctx)
|
||||||
dst = f_m
|
if _, ok := f.Composite.(*Array); ok {
|
||||||
} else {
|
c.errorf(refctx.Key.Key, "cannot index into array")
|
||||||
m := &Map{
|
return
|
||||||
|
}
|
||||||
|
f_m := ToMap(f)
|
||||||
|
if f_m == nil {
|
||||||
|
f_m = &Map{
|
||||||
parent: f,
|
parent: f,
|
||||||
}
|
}
|
||||||
f.Composite = m
|
f.Composite = f_m
|
||||||
dst = m
|
|
||||||
}
|
}
|
||||||
|
dst = f_m
|
||||||
}
|
}
|
||||||
|
|
||||||
eida := NewEdgeIDs(k)
|
eida := NewEdgeIDs(refctx.Key)
|
||||||
for i, eid := range eida {
|
for i, eid := range eida {
|
||||||
var e *Edge
|
var e *Edge
|
||||||
if eid.Index != nil {
|
if eid.Index != nil {
|
||||||
ea := dst.GetEdges(eid)
|
ea := dst.GetEdges(eid)
|
||||||
if len(ea) == 0 {
|
if len(ea) == 0 {
|
||||||
c.errorf(k.Edges[i], "indexed edge does not exist")
|
c.errorf(refctx.Key.Edges[i], "indexed edge does not exist")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
e = ea[0]
|
e = ea[0]
|
||||||
} else {
|
} else {
|
||||||
_, err := dst.EnsureField(eid.SrcPath)
|
_, err := dst.EnsureField(eid.SrcPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.errorf(k.Edges[i].Src, err.Error())
|
c.errorf(refctx.Key.Edges[i].Src, err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
_, err = dst.EnsureField(eid.DstPath)
|
_, err = dst.EnsureField(eid.DstPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.errorf(k.Edges[i].Dst, err.Error())
|
c.errorf(refctx.Key.Edges[i].Dst, err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
e, err = dst.EnsureEdge(eid)
|
e, err = dst.EnsureEdge(eid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.errorf(k.Edges[i], err.Error())
|
c.errorf(refctx.Key.Edges[i], err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if k.EdgeKey != nil {
|
refctx = refctx.Copy()
|
||||||
|
refctx.Edge = refctx.Key.Edges[i]
|
||||||
|
dst.appendEdgeReferences(e, refctx)
|
||||||
|
|
||||||
|
if refctx.Key.EdgeKey != nil {
|
||||||
if e.Map == nil {
|
if e.Map == nil {
|
||||||
e.Map = &Map{
|
e.Map = &Map{
|
||||||
parent: e,
|
parent: e,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmpk := &d2ast.Key{
|
tmpk := &d2ast.Key{
|
||||||
Range: k.EdgeKey.Range,
|
Range: refctx.Key.EdgeKey.Range,
|
||||||
Key: k.EdgeKey,
|
Key: refctx.Key.EdgeKey,
|
||||||
}
|
}
|
||||||
c.compileField(e.Map, tmpk)
|
c.compileField(e.Map, tmpk)
|
||||||
|
e.Map.appendFieldReferences(0, refctx.Key.EdgeKey, refctx)
|
||||||
} else {
|
} else {
|
||||||
if k.Primary.Unbox() != nil {
|
if refctx.Key.Primary.Unbox() != nil {
|
||||||
e.Primary = &Scalar{
|
e.Primary = &Scalar{
|
||||||
parent: e,
|
parent: e,
|
||||||
Value: k.Primary.Unbox(),
|
Value: refctx.Key.Primary.Unbox(),
|
||||||
}
|
}
|
||||||
} else if k.Value.Map != nil {
|
} else if refctx.Key.Value.Map != nil {
|
||||||
if e.Map == nil {
|
if e.Map == nil {
|
||||||
e.Map = &Map{
|
e.Map = &Map{
|
||||||
parent: e,
|
parent: e,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.compileMap(e.Map, k.Value.Map)
|
c.compileMap(e.Map, refctx.Key.Value.Map)
|
||||||
} else if k.Value.Unbox() != nil {
|
} else if refctx.Key.Value.Unbox() != nil {
|
||||||
c.errorf(k.Value.Unbox(), "edges cannot be assigned arrays")
|
c.errorf(refctx.Key.Value.Unbox(), "edges cannot be assigned arrays")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ func (kr FieldReference) EdgeDest() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (kr FieldReference) InEdge() bool {
|
func (kr FieldReference) InEdge() bool {
|
||||||
return kr.KeyPath != kr.Context.Key.Key
|
return kr.Context.Edge != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type EdgeReference struct {
|
type EdgeReference struct {
|
||||||
|
|
@ -351,6 +351,11 @@ type RefContext struct {
|
||||||
Scope *d2ast.Map
|
Scope *d2ast.Map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rc *RefContext) Copy() *RefContext {
|
||||||
|
tmp := *rc
|
||||||
|
return &tmp
|
||||||
|
}
|
||||||
|
|
||||||
// UnresolvedScopeMap is scope prior to interpreting _
|
// UnresolvedScopeMap is scope prior to interpreting _
|
||||||
// It does this by finding the referenced *Map of rc.Scope
|
// It does this by finding the referenced *Map of rc.Scope
|
||||||
func (rc *RefContext) UnresolvedScopeMap(m *Map) *Map {
|
func (rc *RefContext) UnresolvedScopeMap(m *Map) *Map {
|
||||||
|
|
|
||||||
181
testdata/d2ir/TestCompile/edge/nested.exp.json
generated
vendored
181
testdata/d2ir/TestCompile/edge/nested.exp.json
generated
vendored
|
|
@ -79,22 +79,190 @@
|
||||||
"composite": {
|
"composite": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "y"
|
"name": "y",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:0:0-0:4:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:0:0-0:4:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "z",
|
"name": "z",
|
||||||
"composite": {
|
"composite": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "p"
|
"name": "p",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:9:9-0:10:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "p",
|
||||||
|
"raw_string": "p"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:6:6-0:10:10",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:7:7-0:8:8",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "z",
|
||||||
|
"raw_string": "z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:9:9-0:10:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "p",
|
||||||
|
"raw_string": "p"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:7:7-0:8:8",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "z",
|
||||||
|
"raw_string": "z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:6:6-0:10:10",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:7:7-0:8:8",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "z",
|
||||||
|
"raw_string": "z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/nested.d2,0:9:9-0:10:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "p",
|
||||||
|
"raw_string": "p"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": [
|
"edges": [
|
||||||
|
|
@ -111,7 +279,10 @@
|
||||||
],
|
],
|
||||||
"dst_arrow": true,
|
"dst_arrow": true,
|
||||||
"index": 0
|
"index": 0
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
71
testdata/d2ir/TestCompile/edge/root.exp.json
generated
vendored
71
testdata/d2ir/TestCompile/edge/root.exp.json
generated
vendored
|
|
@ -53,10 +53,72 @@
|
||||||
"base": {
|
"base": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "x"
|
"name": "x",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/root.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/edge/root.d2,0:0:0-0:2:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/root.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "y"
|
"name": "y",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/root.d2,0:5:5-0:6:6",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/edge/root.d2,0:4:4-0:6:6",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/root.d2,0:5:5-0:6:6",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": [
|
"edges": [
|
||||||
|
|
@ -71,7 +133,10 @@
|
||||||
],
|
],
|
||||||
"dst_arrow": true,
|
"dst_arrow": true,
|
||||||
"index": 0
|
"index": 0
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
71
testdata/d2ir/TestCompile/edge/underscore.exp.json
generated
vendored
71
testdata/d2ir/TestCompile/edge/underscore.exp.json
generated
vendored
|
|
@ -97,11 +97,73 @@
|
||||||
"composite": {
|
"composite": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "z"
|
"name": "z",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/underscore.d2,0:12:12-0:13:13",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "z",
|
||||||
|
"raw_string": "z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/edge/underscore.d2,0:11:11-0:14:14",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/underscore.d2,0:12:12-0:13:13",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "z",
|
||||||
|
"raw_string": "z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/underscore.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "p",
|
||||||
|
"raw_string": "p"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/edge/underscore.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/edge/underscore.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "p",
|
||||||
|
"raw_string": "p"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "x"
|
"name": "x"
|
||||||
|
|
@ -120,7 +182,10 @@
|
||||||
],
|
],
|
||||||
"dst_arrow": true,
|
"dst_arrow": true,
|
||||||
"index": 0
|
"index": 0
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
33
testdata/d2ir/TestCompile/field/array.exp.json
generated
vendored
33
testdata/d2ir/TestCompile/field/array.exp.json
generated
vendored
|
|
@ -96,7 +96,38 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/array.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/array.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/array.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
|
|
|
||||||
33
testdata/d2ir/TestCompile/field/label.exp.json
generated
vendored
33
testdata/d2ir/TestCompile/field/label.exp.json
generated
vendored
|
|
@ -51,7 +51,38 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/label.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/label.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/label.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
|
|
|
||||||
88
testdata/d2ir/TestCompile/field/nested.exp.json
generated
vendored
88
testdata/d2ir/TestCompile/field/nested.exp.json
generated
vendored
|
|
@ -66,11 +66,95 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/nested.d2,0:0:0-0:3:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/nested.d2,0:0:0-0:3:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
|
|
|
||||||
121
testdata/d2ir/TestCompile/field/primary/nested.exp.json
generated
vendored
121
testdata/d2ir/TestCompile/field/primary/nested.exp.json
generated
vendored
|
|
@ -99,15 +99,130 @@
|
||||||
"composite": {
|
"composite": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "pqrs"
|
"name": "pqrs",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:11:11-0:15:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "pqrs",
|
||||||
|
"raw_string": "pqrs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:11:11-0:16:16",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:11:11-0:15:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "pqrs",
|
||||||
|
"raw_string": "pqrs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:0:0-0:3:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:0:0-0:3:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/nested.d2,0:2:2-0:3:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
|
|
|
||||||
66
testdata/d2ir/TestCompile/field/primary/root.exp.json
generated
vendored
66
testdata/d2ir/TestCompile/field/primary/root.exp.json
generated
vendored
|
|
@ -84,11 +84,73 @@
|
||||||
"composite": {
|
"composite": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "pqrs"
|
"name": "pqrs",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/root.d2,0:9:9-0:13:13",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "pqrs",
|
||||||
|
"raw_string": "pqrs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/primary/root.d2,0:9:9-0:14:14",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/root.d2,0:9:9-0:13:13",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "pqrs",
|
||||||
|
"raw_string": "pqrs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
}
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/root.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/primary/root.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/primary/root.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
|
|
|
||||||
33
testdata/d2ir/TestCompile/field/root.exp.json
generated
vendored
33
testdata/d2ir/TestCompile/field/root.exp.json
generated
vendored
|
|
@ -30,7 +30,38 @@
|
||||||
"base": {
|
"base": {
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "x"
|
"name": "x",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/root.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "TestCompile/field/root.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "TestCompile/field/root.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"edges": null
|
"edges": null
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue