d2ir: fix importing scopes
This commit is contained in:
parent
e3952ca4d6
commit
24f9150091
14 changed files with 1180 additions and 74 deletions
|
|
@ -351,6 +351,7 @@ func (c *compiler) compileField(obj *d2graph.Object, f *d2ir.Field) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parent := obj
|
||||||
obj = obj.EnsureChild(d2graphIDA([]string{f.Name}))
|
obj = obj.EnsureChild(d2graphIDA([]string{f.Name}))
|
||||||
if f.Primary() != nil {
|
if f.Primary() != nil {
|
||||||
c.compileLabel(&obj.Attributes, f)
|
c.compileLabel(&obj.Attributes, f)
|
||||||
|
|
@ -376,6 +377,7 @@ func (c *compiler) compileField(obj *d2graph.Object, f *d2ir.Field) {
|
||||||
MapKeyEdgeIndex: fr.Context_.EdgeIndex(),
|
MapKeyEdgeIndex: fr.Context_.EdgeIndex(),
|
||||||
Scope: fr.Context_.Scope,
|
Scope: fr.Context_.Scope,
|
||||||
ScopeAST: fr.Context_.ScopeAST,
|
ScopeAST: fr.Context_.ScopeAST,
|
||||||
|
ScopeObj: parent,
|
||||||
}
|
}
|
||||||
if fr.Context_.ScopeMap != nil && !d2ir.IsVar(fr.Context_.ScopeMap) {
|
if fr.Context_.ScopeMap != nil && !d2ir.IsVar(fr.Context_.ScopeMap) {
|
||||||
scopeObjIDA := d2graphIDA(d2ir.BoardIDA(fr.Context_.ScopeMap))
|
scopeObjIDA := d2graphIDA(d2ir.BoardIDA(fr.Context_.ScopeMap))
|
||||||
|
|
@ -777,6 +779,7 @@ func (c *compiler) compileEdge(obj *d2graph.Object, e *d2ir.Edge) {
|
||||||
MapKeyEdgeIndex: er.Context_.EdgeIndex(),
|
MapKeyEdgeIndex: er.Context_.EdgeIndex(),
|
||||||
Scope: er.Context_.Scope,
|
Scope: er.Context_.Scope,
|
||||||
ScopeAST: er.Context_.ScopeAST,
|
ScopeAST: er.Context_.ScopeAST,
|
||||||
|
ScopeObj: obj,
|
||||||
}
|
}
|
||||||
if er.Context_.ScopeMap != nil && !d2ir.IsVar(er.Context_.ScopeMap) {
|
if er.Context_.ScopeMap != nil && !d2ir.IsVar(er.Context_.ScopeMap) {
|
||||||
scopeObjIDA := d2graphIDA(d2ir.BoardIDA(er.Context_.ScopeMap))
|
scopeObjIDA := d2graphIDA(d2ir.BoardIDA(er.Context_.ScopeMap))
|
||||||
|
|
|
||||||
|
|
@ -1523,6 +1523,36 @@ x -> y: {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "nested-scope-1",
|
||||||
|
|
||||||
|
text: `...@second
|
||||||
|
`,
|
||||||
|
files: map[string]string{
|
||||||
|
"second.d2": `second: {
|
||||||
|
...@third
|
||||||
|
}`,
|
||||||
|
"third.d2": `third: {
|
||||||
|
elem
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||||
|
assert.Equal(t, 3, len(g.Objects))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "nested-scope-2",
|
||||||
|
|
||||||
|
text: `...@second
|
||||||
|
a.style.fill: null
|
||||||
|
`,
|
||||||
|
files: map[string]string{
|
||||||
|
"second.d2": `a.style.fill: red`,
|
||||||
|
},
|
||||||
|
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||||
|
assert.Equal(t, 1, len(g.Objects))
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "url_tooltip",
|
name: "url_tooltip",
|
||||||
text: `x: {tooltip: https://google.com}`,
|
text: `x: {tooltip: https://google.com}`,
|
||||||
|
|
@ -2998,8 +3028,8 @@ qa: {
|
||||||
assertions: func(t *testing.T, g *d2graph.Graph) {
|
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||||
tassert.Equal(t, "dev.env", g.Objects[1].AbsID())
|
tassert.Equal(t, "dev.env", g.Objects[1].AbsID())
|
||||||
tassert.Equal(t, "Dev Environment", g.Objects[1].Label.Value)
|
tassert.Equal(t, "Dev Environment", g.Objects[1].Label.Value)
|
||||||
tassert.Equal(t, "qa.env", g.Objects[4].AbsID())
|
tassert.Equal(t, "qa.env", g.Objects[2].AbsID())
|
||||||
tassert.Equal(t, "Qa Environment", g.Objects[4].Label.Value)
|
tassert.Equal(t, "Qa Environment", g.Objects[2].Label.Value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -541,6 +541,7 @@ func (c *compiler) compileMap(dst *Map, ast, scopeAST *d2ast.Map) {
|
||||||
}
|
}
|
||||||
dst.Fields = append(dst.Fields, f)
|
dst.Fields = append(dst.Fields, f)
|
||||||
case n.Import != nil:
|
case n.Import != nil:
|
||||||
|
// Spread import
|
||||||
impn, ok := c._import(n.Import)
|
impn, ok := c._import(n.Import)
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
|
|
@ -867,6 +868,7 @@ func (c *compiler) _compileField(f *Field, refctx *RefContext) {
|
||||||
c.overlayClasses(f.Map())
|
c.overlayClasses(f.Map())
|
||||||
}
|
}
|
||||||
} else if refctx.Key.Value.Import != nil {
|
} else if refctx.Key.Value.Import != nil {
|
||||||
|
// Non-spread import
|
||||||
n, ok := c._import(refctx.Key.Value.Import)
|
n, ok := c._import(refctx.Key.Value.Import)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -61,18 +61,15 @@ func (c *compiler) _import(imp *d2ast.Import) (Node, bool) {
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
nilScopeMap(ir)
|
||||||
if len(imp.IDA()) > 0 {
|
if len(imp.IDA()) > 0 {
|
||||||
f := ir.GetField(imp.IDA()...)
|
f := ir.GetField(imp.IDA()...)
|
||||||
if f == nil {
|
if f == nil {
|
||||||
c.errorf(imp, "import key %q doesn't exist inside import", imp.IDA())
|
c.errorf(imp, "import key %q doesn't exist inside import", imp.IDA())
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
if f.Map() != nil {
|
|
||||||
nilScopeMap(f.Map())
|
|
||||||
}
|
|
||||||
return f, true
|
return f, true
|
||||||
}
|
}
|
||||||
nilScopeMap(ir)
|
|
||||||
return ir, true
|
return ir, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,9 +132,15 @@ func nilScopeMap(n Node) {
|
||||||
for _, r := range n.References {
|
for _, r := range n.References {
|
||||||
r.Context_.ScopeMap = nil
|
r.Context_.ScopeMap = nil
|
||||||
}
|
}
|
||||||
|
if n.Map() != nil {
|
||||||
|
nilScopeMap(n.Map())
|
||||||
|
}
|
||||||
case *Field:
|
case *Field:
|
||||||
for _, r := range n.References {
|
for _, r := range n.References {
|
||||||
r.Context_.ScopeMap = nil
|
r.Context_.ScopeMap = nil
|
||||||
}
|
}
|
||||||
|
if n.Map() != nil {
|
||||||
|
nilScopeMap(n.Map())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,6 +211,23 @@ label: meow`,
|
||||||
assert.Success(t, err)
|
assert.Success(t, err)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "nested-scope",
|
||||||
|
run: func(t testing.TB) {
|
||||||
|
m, err := compileFS(t, "index.d2", map[string]string{
|
||||||
|
"index.d2": `...@second
|
||||||
|
`,
|
||||||
|
"second.d2": `elem: {
|
||||||
|
...@third
|
||||||
|
}`,
|
||||||
|
"third.d2": `third: {
|
||||||
|
elem
|
||||||
|
}`,
|
||||||
|
})
|
||||||
|
assert.Success(t, err)
|
||||||
|
assertQuery(t, m, 3, 0, nil, "")
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
runa(t, tca)
|
runa(t, tca)
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,30 @@ if i'm right: {
|
||||||
a <- b: fix
|
a <- b: fix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if i'm wrong: {
|
||||||
|
a <- b: nah, intended
|
||||||
|
}`)
|
||||||
|
err := runTestMain(t, ctx, dir, env, "index.d2")
|
||||||
|
assert.Success(t, err)
|
||||||
|
|
||||||
|
assert.TestdataDir(t, filepath.Join(dir, "index"))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "sequence-spread-layer",
|
||||||
|
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
|
||||||
|
writeFile(t, dir, "index.d2", `k; layers: { seq: {...@seq.d2} }`)
|
||||||
|
writeFile(t, dir, "seq.d2", `shape: sequence_diagram
|
||||||
|
a: me
|
||||||
|
b: github.com/terrastruct/d2
|
||||||
|
|
||||||
|
a -> b: issue about a bug
|
||||||
|
a."some note about the bug"
|
||||||
|
|
||||||
|
if i'm right: {
|
||||||
|
a <- b: fix
|
||||||
|
}
|
||||||
|
|
||||||
if i'm wrong: {
|
if i'm wrong: {
|
||||||
a <- b: nah, intended
|
a <- b: nah, intended
|
||||||
}`)
|
}`)
|
||||||
|
|
|
||||||
Binary file not shown.
95
e2etests-cli/testdata/TestCLI_E2E/sequence-spread-layer/index.exp.svg
vendored
Normal file
95
e2etests-cli/testdata/TestCLI_E2E/sequence-spread-layer/index.exp.svg
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" d2Version="v0.6.6-HEAD" preserveAspectRatio="xMinYMin meet" viewBox="0 0 255 268"><svg id="d2-svg" class="d2-1573652205" width="255" height="268" viewBox="-101 -101 255 268"><rect x="-101.000000" y="-101.000000" width="255.000000" height="268.000000" rx="0.000000" class=" fill-N7" stroke-width="0" /><style type="text/css"><![CDATA[
|
||||||
|
.d2-1573652205 .text-bold {
|
||||||
|
font-family: "d2-1573652205-font-bold";
|
||||||
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: d2-1573652205-font-bold;
|
||||||
|
src: url("data:application/font-woff;base64,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");
|
||||||
|
}]]></style><style type="text/css"><![CDATA[.shape {
|
||||||
|
shape-rendering: geometricPrecision;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
}
|
||||||
|
.connection {
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
}
|
||||||
|
.blend {
|
||||||
|
mix-blend-mode: multiply;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.d2-1573652205 .fill-N1{fill:#0A0F25;}
|
||||||
|
.d2-1573652205 .fill-N2{fill:#676C7E;}
|
||||||
|
.d2-1573652205 .fill-N3{fill:#9499AB;}
|
||||||
|
.d2-1573652205 .fill-N4{fill:#CFD2DD;}
|
||||||
|
.d2-1573652205 .fill-N5{fill:#DEE1EB;}
|
||||||
|
.d2-1573652205 .fill-N6{fill:#EEF1F8;}
|
||||||
|
.d2-1573652205 .fill-N7{fill:#FFFFFF;}
|
||||||
|
.d2-1573652205 .fill-B1{fill:#0D32B2;}
|
||||||
|
.d2-1573652205 .fill-B2{fill:#0D32B2;}
|
||||||
|
.d2-1573652205 .fill-B3{fill:#E3E9FD;}
|
||||||
|
.d2-1573652205 .fill-B4{fill:#E3E9FD;}
|
||||||
|
.d2-1573652205 .fill-B5{fill:#EDF0FD;}
|
||||||
|
.d2-1573652205 .fill-B6{fill:#F7F8FE;}
|
||||||
|
.d2-1573652205 .fill-AA2{fill:#4A6FF3;}
|
||||||
|
.d2-1573652205 .fill-AA4{fill:#EDF0FD;}
|
||||||
|
.d2-1573652205 .fill-AA5{fill:#F7F8FE;}
|
||||||
|
.d2-1573652205 .fill-AB4{fill:#EDF0FD;}
|
||||||
|
.d2-1573652205 .fill-AB5{fill:#F7F8FE;}
|
||||||
|
.d2-1573652205 .stroke-N1{stroke:#0A0F25;}
|
||||||
|
.d2-1573652205 .stroke-N2{stroke:#676C7E;}
|
||||||
|
.d2-1573652205 .stroke-N3{stroke:#9499AB;}
|
||||||
|
.d2-1573652205 .stroke-N4{stroke:#CFD2DD;}
|
||||||
|
.d2-1573652205 .stroke-N5{stroke:#DEE1EB;}
|
||||||
|
.d2-1573652205 .stroke-N6{stroke:#EEF1F8;}
|
||||||
|
.d2-1573652205 .stroke-N7{stroke:#FFFFFF;}
|
||||||
|
.d2-1573652205 .stroke-B1{stroke:#0D32B2;}
|
||||||
|
.d2-1573652205 .stroke-B2{stroke:#0D32B2;}
|
||||||
|
.d2-1573652205 .stroke-B3{stroke:#E3E9FD;}
|
||||||
|
.d2-1573652205 .stroke-B4{stroke:#E3E9FD;}
|
||||||
|
.d2-1573652205 .stroke-B5{stroke:#EDF0FD;}
|
||||||
|
.d2-1573652205 .stroke-B6{stroke:#F7F8FE;}
|
||||||
|
.d2-1573652205 .stroke-AA2{stroke:#4A6FF3;}
|
||||||
|
.d2-1573652205 .stroke-AA4{stroke:#EDF0FD;}
|
||||||
|
.d2-1573652205 .stroke-AA5{stroke:#F7F8FE;}
|
||||||
|
.d2-1573652205 .stroke-AB4{stroke:#EDF0FD;}
|
||||||
|
.d2-1573652205 .stroke-AB5{stroke:#F7F8FE;}
|
||||||
|
.d2-1573652205 .background-color-N1{background-color:#0A0F25;}
|
||||||
|
.d2-1573652205 .background-color-N2{background-color:#676C7E;}
|
||||||
|
.d2-1573652205 .background-color-N3{background-color:#9499AB;}
|
||||||
|
.d2-1573652205 .background-color-N4{background-color:#CFD2DD;}
|
||||||
|
.d2-1573652205 .background-color-N5{background-color:#DEE1EB;}
|
||||||
|
.d2-1573652205 .background-color-N6{background-color:#EEF1F8;}
|
||||||
|
.d2-1573652205 .background-color-N7{background-color:#FFFFFF;}
|
||||||
|
.d2-1573652205 .background-color-B1{background-color:#0D32B2;}
|
||||||
|
.d2-1573652205 .background-color-B2{background-color:#0D32B2;}
|
||||||
|
.d2-1573652205 .background-color-B3{background-color:#E3E9FD;}
|
||||||
|
.d2-1573652205 .background-color-B4{background-color:#E3E9FD;}
|
||||||
|
.d2-1573652205 .background-color-B5{background-color:#EDF0FD;}
|
||||||
|
.d2-1573652205 .background-color-B6{background-color:#F7F8FE;}
|
||||||
|
.d2-1573652205 .background-color-AA2{background-color:#4A6FF3;}
|
||||||
|
.d2-1573652205 .background-color-AA4{background-color:#EDF0FD;}
|
||||||
|
.d2-1573652205 .background-color-AA5{background-color:#F7F8FE;}
|
||||||
|
.d2-1573652205 .background-color-AB4{background-color:#EDF0FD;}
|
||||||
|
.d2-1573652205 .background-color-AB5{background-color:#F7F8FE;}
|
||||||
|
.d2-1573652205 .color-N1{color:#0A0F25;}
|
||||||
|
.d2-1573652205 .color-N2{color:#676C7E;}
|
||||||
|
.d2-1573652205 .color-N3{color:#9499AB;}
|
||||||
|
.d2-1573652205 .color-N4{color:#CFD2DD;}
|
||||||
|
.d2-1573652205 .color-N5{color:#DEE1EB;}
|
||||||
|
.d2-1573652205 .color-N6{color:#EEF1F8;}
|
||||||
|
.d2-1573652205 .color-N7{color:#FFFFFF;}
|
||||||
|
.d2-1573652205 .color-B1{color:#0D32B2;}
|
||||||
|
.d2-1573652205 .color-B2{color:#0D32B2;}
|
||||||
|
.d2-1573652205 .color-B3{color:#E3E9FD;}
|
||||||
|
.d2-1573652205 .color-B4{color:#E3E9FD;}
|
||||||
|
.d2-1573652205 .color-B5{color:#EDF0FD;}
|
||||||
|
.d2-1573652205 .color-B6{color:#F7F8FE;}
|
||||||
|
.d2-1573652205 .color-AA2{color:#4A6FF3;}
|
||||||
|
.d2-1573652205 .color-AA4{color:#EDF0FD;}
|
||||||
|
.d2-1573652205 .color-AA5{color:#F7F8FE;}
|
||||||
|
.d2-1573652205 .color-AB4{color:#EDF0FD;}
|
||||||
|
.d2-1573652205 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]></style><g id="k"><g class="shape" ><rect x="0.000000" y="0.000000" width="53.000000" height="66.000000" class=" stroke-B1 fill-B6" style="stroke-width:2;" /></g><text x="26.500000" y="38.500000" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">k</text></g><mask id="d2-1573652205" maskUnits="userSpaceOnUse" x="-101" y="-101" width="255" height="268">
|
||||||
|
<rect x="-101" y="-101" width="255" height="268" fill="white"></rect>
|
||||||
|
<rect x="22.500000" y="22.500000" width="8" height="21" fill="rgba(0,0,0,0.75)"></rect>
|
||||||
|
</mask></svg></svg>
|
||||||
|
After Width: | Height: | Size: 8.4 KiB |
109
e2etests-cli/testdata/TestCLI_E2E/sequence-spread-layer/seq.exp.svg
vendored
Normal file
109
e2etests-cli/testdata/TestCLI_E2E/sequence-spread-layer/seq.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 19 KiB |
193
testdata/d2compiler/TestCompile/nested-scope-1.exp.json
generated
vendored
Normal file
193
testdata/d2compiler/TestCompile/nested-scope-1.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,193 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-1.d2,0:0:0-1:0:11",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-1.d2,0:0:0-0:10:10",
|
||||||
|
"spread": true,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-1.d2,0:4:4-0:10:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "second",
|
||||||
|
"raw_string": "second"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "second",
|
||||||
|
"id_val": "second",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/second.d2,0:0:0-0:6:6",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/second.d2,0:0:0-0:6:6",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "second",
|
||||||
|
"raw_string": "second"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "second"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "third",
|
||||||
|
"id_val": "third",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/third.d2,0:0:0-0:5:5",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/third.d2,0:0:0-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "third",
|
||||||
|
"raw_string": "third"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "third"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "elem",
|
||||||
|
"id_val": "elem",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/third.d2,1:2:11-1:6:15",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/third.d2,1:2:11-1:6:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "elem"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
216
testdata/d2compiler/TestCompile/nested-scope-2.exp.json
generated
vendored
Normal file
216
testdata/d2compiler/TestCompile/nested-scope-2.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,216 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,0:0:0-2:0:30",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,0:0:0-0:10:10",
|
||||||
|
"spread": true,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,0:4:4-0:10:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "second",
|
||||||
|
"raw_string": "second"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:0:11-1:18:29",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:0:11-1:12:23",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:0:11-1:1:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:2:13-1:7:18",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:8:19-1:12:23",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"null": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:14:25-1:18:29"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "a",
|
||||||
|
"id_val": "a",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/second.d2,0:0:0-0:12:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/second.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/second.d2,0:2:2-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/second.d2,0:8:8-0:12:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:0:11-1:12:23",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:0:11-1:1:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:2:13-1:7:18",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope-2.d2,1:8:19-1:12:23",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "a"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
193
testdata/d2compiler/TestCompile/nested-scope.exp.json
generated
vendored
Normal file
193
testdata/d2compiler/TestCompile/nested-scope.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,193 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope.d2,0:0:0-1:0:11",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope.d2,0:0:0-0:10:10",
|
||||||
|
"spread": true,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/nested-scope.d2,0:4:4-0:10:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "second",
|
||||||
|
"raw_string": "second"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": null,
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "second",
|
||||||
|
"id_val": "second",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/second.d2,0:0:0-0:6:6",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/second.d2,0:0:0-0:6:6",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "second",
|
||||||
|
"raw_string": "second"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "second"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "third",
|
||||||
|
"id_val": "third",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/third.d2,0:0:0-0:5:5",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/third.d2,0:0:0-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "third",
|
||||||
|
"raw_string": "third"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "third"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "elem",
|
||||||
|
"id_val": "elem",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/third.d2,1:2:11-1:6:15",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/third.d2,1:2:11-1:6:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "elem"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
113
testdata/d2compiler/TestCompile/vars-in-imports.exp.json
generated
vendored
113
testdata/d2compiler/TestCompile/vars-in-imports.exp.json
generated
vendored
|
|
@ -344,74 +344,6 @@
|
||||||
},
|
},
|
||||||
"zIndex": 0
|
"zIndex": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "vm",
|
|
||||||
"id_val": "vm",
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/template.d2,2:2:37-2:4:39",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2compiler/TestCompile/template.d2,2:2:37-2:4:39",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "vm",
|
|
||||||
"raw_string": "vm"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "My Virtual machine!"
|
|
||||||
},
|
|
||||||
"labelDimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": null
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "env",
|
|
||||||
"id_val": "env",
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "env"
|
|
||||||
},
|
|
||||||
"labelDimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": null
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "env",
|
"id": "env",
|
||||||
"id_val": "env",
|
"id_val": "env",
|
||||||
|
|
@ -502,6 +434,51 @@
|
||||||
},
|
},
|
||||||
"zIndex": 0
|
"zIndex": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "vm",
|
||||||
|
"id_val": "vm",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/template.d2,2:2:37-2:4:39",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/template.d2,2:2:37-2:4:39",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "vm",
|
||||||
|
"raw_string": "vm"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "My Virtual machine!"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "qa",
|
"id": "qa",
|
||||||
"id_val": "qa",
|
"id_val": "qa",
|
||||||
|
|
|
||||||
244
testdata/d2ir/TestCompile/imports/nested-scope.exp.json
generated
vendored
Normal file
244
testdata/d2ir/TestCompile/imports/nested-scope.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,244 @@
|
||||||
|
{
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "elem",
|
||||||
|
"composite": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "third",
|
||||||
|
"composite": {
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "elem",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"edge": null,
|
||||||
|
"key": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"key": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"due_to_glob": false,
|
||||||
|
"due_to_lazy_glob": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edges": null
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"range": "third.d2,0:0:0-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "third",
|
||||||
|
"raw_string": "third"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "third.d2,0:0:0-0:5:5",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "third.d2,0:0:0-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "third",
|
||||||
|
"raw_string": "third"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"edge": null,
|
||||||
|
"key": {
|
||||||
|
"range": "third.d2,0:0:0-2:1:17",
|
||||||
|
"key": {
|
||||||
|
"range": "third.d2,0:0:0-0:5:5",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "third.d2,0:0:0-0:5:5",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "third",
|
||||||
|
"raw_string": "third"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "third.d2,0:7:7-2:1:17",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"key": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "third.d2,1:2:11-1:6:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"due_to_glob": false,
|
||||||
|
"due_to_lazy_glob": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edges": null
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"string": {
|
||||||
|
"range": "second.d2,0:0:0-0:4:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path": {
|
||||||
|
"range": "second.d2,0:0:0-0:4:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "second.d2,0:0:0-0:4:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"edge": null,
|
||||||
|
"key": {
|
||||||
|
"range": "second.d2,0:0:0-2:1:21",
|
||||||
|
"key": {
|
||||||
|
"range": "second.d2,0:0:0-0:4:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "second.d2,0:0:0-0:4:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "elem",
|
||||||
|
"raw_string": "elem"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "second.d2,0:6:6-2:1:21",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"import": {
|
||||||
|
"range": "second.d2,1:2:10-1:11:19",
|
||||||
|
"spread": true,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "second.d2,1:6:14-1:11:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "third",
|
||||||
|
"raw_string": "third"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"due_to_glob": false,
|
||||||
|
"due_to_lazy_glob": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"edges": null
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue