fix set with imports
This commit is contained in:
parent
fcaba26a28
commit
99c4215548
6 changed files with 888 additions and 106 deletions
|
|
@ -391,6 +391,9 @@ func _set(g *d2graph.Graph, baseAST *d2ast.Map, key string, tag, value *string)
|
||||||
maybeNewScope = ref.MapKey.Value.Map
|
maybeNewScope = ref.MapKey.Value.Map
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if IsImported(g, obj) {
|
||||||
|
appendMapKey(scope, mk)
|
||||||
|
return nil
|
||||||
} else {
|
} else {
|
||||||
maybeNewScope = obj.Map
|
maybeNewScope = obj.Map
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2071,6 +2071,40 @@ a`,
|
||||||
exp: `...@yo
|
exp: `...@yo
|
||||||
a
|
a
|
||||||
b.style.fill: red
|
b.style.fill: red
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "import/5",
|
||||||
|
|
||||||
|
text: `a
|
||||||
|
x: {
|
||||||
|
...@yo
|
||||||
|
}`,
|
||||||
|
fsTexts: map[string]string{
|
||||||
|
"yo.d2": `b`,
|
||||||
|
},
|
||||||
|
key: `x.b.style.fill`,
|
||||||
|
value: go2.Pointer(`red`),
|
||||||
|
exp: `a
|
||||||
|
x: {
|
||||||
|
...@yo
|
||||||
|
b.style.fill: red
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "import/6",
|
||||||
|
|
||||||
|
text: `a
|
||||||
|
x: @yo`,
|
||||||
|
fsTexts: map[string]string{
|
||||||
|
"yo.d2": `b`,
|
||||||
|
},
|
||||||
|
key: `x.b.style.fill`,
|
||||||
|
value: go2.Pointer(`red`),
|
||||||
|
exp: `a
|
||||||
|
x: @yo
|
||||||
|
x.b.style.fill: red
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,16 @@ func GetParentID(g *d2graph.Graph, boardPath []string, absID string) (string, er
|
||||||
return obj.Parent.AbsID(), nil
|
return obj.Parent.AbsID(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsImported(g *d2graph.Graph, obj *d2graph.Object) bool {
|
||||||
|
for _, ref := range obj.References {
|
||||||
|
if ref.MapKey.Range.Path == g.AST.Range.Path {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func GetObj(g *d2graph.Graph, boardPath []string, absID string) *d2graph.Object {
|
func GetObj(g *d2graph.Graph, boardPath []string, absID string) *d2graph.Object {
|
||||||
g = GetBoardGraph(g, boardPath)
|
g = GetBoardGraph(g, boardPath)
|
||||||
if g == nil {
|
if g == nil {
|
||||||
|
|
|
||||||
187
testdata/d2oracle/TestSet/import/4.exp.json
generated
vendored
187
testdata/d2oracle/TestSet/import/4.exp.json
generated
vendored
|
|
@ -3,17 +3,17 @@
|
||||||
"name": "",
|
"name": "",
|
||||||
"isFolderOnly": false,
|
"isFolderOnly": false,
|
||||||
"ast": {
|
"ast": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,0:0:0-3:0:27",
|
"range": "index.d2,0:0:0-3:0:27",
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{
|
{
|
||||||
"import": {
|
"import": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,0:0:0-0:6:6",
|
"range": "index.d2,0:0:0-0:6:6",
|
||||||
"spread": true,
|
"spread": true,
|
||||||
"pre": "",
|
"pre": "",
|
||||||
"path": [
|
"path": [
|
||||||
{
|
{
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,0:4:4-0:6:6",
|
"range": "index.d2,0:4:4-0:6:6",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "yo",
|
"string": "yo",
|
||||||
|
|
@ -27,13 +27,13 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"map_key": {
|
"map_key": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,1:0:7-1:1:8",
|
"range": "index.d2,1:0:7-1:1:8",
|
||||||
"key": {
|
"key": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,1:0:7-1:1:8",
|
"range": "index.d2,1:0:7-1:1:8",
|
||||||
"path": [
|
"path": [
|
||||||
{
|
{
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,1:0:7-1:1:8",
|
"range": "index.d2,1:0:7-1:1:8",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "a",
|
"string": "a",
|
||||||
|
|
@ -50,13 +50,13 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"map_key": {
|
"map_key": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:0:9-2:17:26",
|
"range": "index.d2,2:0:9-2:17:26",
|
||||||
"key": {
|
"key": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:0:9-2:12:21",
|
"range": "index.d2,2:0:9-2:12:21",
|
||||||
"path": [
|
"path": [
|
||||||
{
|
{
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:0:9-2:1:10",
|
"range": "index.d2,2:0:9-2:1:10",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "b",
|
"string": "b",
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:2:11-2:7:16",
|
"range": "index.d2,2:2:11-2:7:16",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "style",
|
"string": "style",
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:8:17-2:12:21",
|
"range": "index.d2,2:8:17-2:12:21",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "fill",
|
"string": "fill",
|
||||||
|
|
@ -92,7 +92,7 @@
|
||||||
"primary": {},
|
"primary": {},
|
||||||
"value": {
|
"value": {
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:14:23-2:17:26",
|
"range": "index.d2,2:14:23-2:17:26",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "red",
|
"string": "red",
|
||||||
|
|
@ -130,107 +130,37 @@
|
||||||
},
|
},
|
||||||
"edges": null,
|
"edges": null,
|
||||||
"objects": [
|
"objects": [
|
||||||
{
|
|
||||||
"id": "bb",
|
|
||||||
"id_val": "bb",
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/yo.d2,0:0:0-0:2:2",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/yo.d2,0:0:0-0:2:2",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "bb",
|
|
||||||
"raw_string": "bb"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"key_path_index": 0,
|
|
||||||
"map_key_edge_index": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attributes": {
|
|
||||||
"label": {
|
|
||||||
"value": "bb"
|
|
||||||
},
|
|
||||||
"labelDimensions": {
|
|
||||||
"width": 0,
|
|
||||||
"height": 0
|
|
||||||
},
|
|
||||||
"style": {},
|
|
||||||
"near_key": null,
|
|
||||||
"shape": {
|
|
||||||
"value": "rectangle"
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"value": ""
|
|
||||||
},
|
|
||||||
"constraint": null
|
|
||||||
},
|
|
||||||
"zIndex": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "a",
|
|
||||||
"id_val": "a",
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,1:0:7-1:1:8",
|
|
||||||
"path": [
|
|
||||||
{
|
|
||||||
"unquoted_string": {
|
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,1:0:7-1:1:8",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"string": "a",
|
|
||||||
"raw_string": "a"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"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
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "b",
|
"id": "b",
|
||||||
"id_val": "b",
|
"id_val": "b",
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"key": {
|
"key": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:0:9-2:12:21",
|
"range": "yo.d2,0:0:0-0:1:1",
|
||||||
"path": [
|
"path": [
|
||||||
{
|
{
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:0:9-2:1:10",
|
"range": "yo.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,2:0:9-2:12:21",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:0:9-2:1:10",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "b",
|
"string": "b",
|
||||||
|
|
@ -241,7 +171,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:2:11-2:7:16",
|
"range": "index.d2,2:2:11-2:7:16",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "style",
|
"string": "style",
|
||||||
|
|
@ -252,7 +182,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"unquoted_string": {
|
"unquoted_string": {
|
||||||
"range": "d2/testdata/d2oracle/TestSet/import/4.d2,2:8:17-2:12:21",
|
"range": "index.d2,2:8:17-2:12:21",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"string": "fill",
|
"string": "fill",
|
||||||
|
|
@ -290,6 +220,51 @@
|
||||||
"constraint": null
|
"constraint": null
|
||||||
},
|
},
|
||||||
"zIndex": 0
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "a",
|
||||||
|
"id_val": "a",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,1:0:7-1:1:8",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,1:0:7-1:1:8",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
346
testdata/d2oracle/TestSet/import/5.exp.json
generated
vendored
Normal file
346
testdata/d2oracle/TestSet/import/5.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,346 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "index.d2,0:0:0-5:0:38",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "index.d2,0:0:0-0:1:1",
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "index.d2,1:0:2-4:1:37",
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,1:0:2-1:1:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,1:0:2-1:1:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "index.d2,1:3:5-4:1:37",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"import": {
|
||||||
|
"range": "index.d2,2:2:9-2:8:15",
|
||||||
|
"spread": true,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:6:13-2:8:15",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "yo",
|
||||||
|
"raw_string": "yo"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "index.d2,3:2:18-3:19:35",
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,3:2:18-3:14:30",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,3:2:18-3:3:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,3:4:20-3:9:25",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,3:10:26-3:14:30",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,3:16:32-3:19:35",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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": "index.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "b",
|
||||||
|
"id_val": "b",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "yo.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "yo.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,3:2:18-3:14:30",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,3:2:18-3:3:19",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,3:4:20-3:9:25",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,3:10:26-3:14:30",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "b"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"fill": {
|
||||||
|
"value": "red"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "x",
|
||||||
|
"id_val": "x",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,1:0:2-1:1:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,1:0:2-1:1:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "x"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": "<nil>"
|
||||||
|
}
|
||||||
414
testdata/d2oracle/TestSet/import/6.exp.json
generated
vendored
Normal file
414
testdata/d2oracle/TestSet/import/6.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,414 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": false,
|
||||||
|
"ast": {
|
||||||
|
"range": "index.d2,0:0:0-3:0:29",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "index.d2,0:0:0-0:1:1",
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "index.d2,1:0:2-1:6:8",
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,1:0:2-1:1:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,1:0:2-1:1:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"import": {
|
||||||
|
"range": "index.d2,1:3:5-1:6:8",
|
||||||
|
"spread": false,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,1:4:6-1:6:8",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "yo",
|
||||||
|
"raw_string": "yo"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "index.d2,2:0:9-2:19:28",
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,2:0:9-2:14:23",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:0:9-2:1:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:2:11-2:3:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:4:13-2:9:18",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:10:19-2:14:23",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:16:25-2:19:28",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "red",
|
||||||
|
"raw_string": "red"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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": "index.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "b",
|
||||||
|
"id_val": "b",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "yo.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "yo.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,2:0:9-2:14:23",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:0:9-2:1:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:2:11-2:3:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:4:13-2:9:18",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:10:19-2:14:23",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 1,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "b"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"fill": {
|
||||||
|
"value": "red"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "x",
|
||||||
|
"id_val": "x",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,1:0:2-1:1:3",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,1:0:2-1:1:3",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "index.d2,2:0:9-2:14:23",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:0:9-2:1:10",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:2:11-2:3:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:4:13-2:9:18",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "index.d2,2:10:19-2:14:23",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "fill",
|
||||||
|
"raw_string": "fill"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "x"
|
||||||
|
},
|
||||||
|
"labelDimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "rectangle"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"constraint": null
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": "<nil>"
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue