diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index b9df3323a..c3ce5c5e7 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -5666,6 +5666,27 @@ a: { assert.Equal(t, 1, len(g.Edges)) }, }, + { + name: "unsuspend-cross-container-edge-label", + run: func(t *testing.T) { + g, _ := assertCompile(t, ` +a: { + b +} +c: { + d +} +a.b -> c.d: likes +**: suspend +(** -> **)[*]: suspend +(** -> **)[*]: unsuspend { + &label: likes +} +`, ``) + assert.Equal(t, 4, len(g.Objects)) + assert.Equal(t, 1, len(g.Edges)) + }, + }, { name: "unsuspend-shape-label", run: func(t *testing.T) { diff --git a/d2ir/compile.go b/d2ir/compile.go index 71e8d7c7e..9473b7e37 100644 --- a/d2ir/compile.go +++ b/d2ir/compile.go @@ -1322,6 +1322,21 @@ func (c *compiler) _compileEdges(refctx *RefContext) { if refctx.Key.Primary.Suspension != nil || refctx.Key.Value.Suspension != nil { if !c.lazyGlobBeingApplied { + // Check if edge passes filter before applying suspension + if refctx.Key.Value.Map != nil && refctx.Key.Value.Map.HasFilter() { + if e.Map_ == nil { + e.Map_ = &Map{ + parent: e, + } + } + c.mapRefContextStack = append(c.mapRefContextStack, refctx) + ok := c.ampersandFilterMap(e.Map_, refctx.Key.Value.Map, refctx.ScopeAST) + c.mapRefContextStack = c.mapRefContextStack[:len(c.mapRefContextStack)-1] + if !ok { + continue + } + } + var suspensionValue bool if refctx.Key.Primary.Suspension != nil { suspensionValue = refctx.Key.Primary.Suspension.Value @@ -1334,6 +1349,8 @@ func (c *compiler) _compileEdges(refctx *RefContext) { // And their ancestors if !suspensionValue { srcPath, dstPath := e.ID.SrcPath, e.ID.DstPath + + // Make paths absolute if they're relative container := ParentField(e) if container != nil && container.Name.ScalarString() != "root" { containerPath := []d2ast.String{} @@ -1358,6 +1375,7 @@ func (c *compiler) _compileEdges(refctx *RefContext) { srcObj := rootMap.GetField(srcPath...) dstObj := rootMap.GetField(dstPath...) + // Unsuspend source node and all its ancestors if srcObj != nil { srcObj.suspended = false parent := ParentField(srcObj) @@ -1366,9 +1384,11 @@ func (c *compiler) _compileEdges(refctx *RefContext) { parent = ParentField(parent) } } + + // Unsuspend destination node and all its ancestors if dstObj != nil { dstObj.suspended = false - parent := ParentField(srcObj) + parent := ParentField(dstObj) for parent != nil && parent.Name.ScalarString() != "root" { parent.suspended = false parent = ParentField(parent) diff --git a/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.exp.json b/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.exp.json new file mode 100644 index 000000000..70fca048f --- /dev/null +++ b/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.exp.json @@ -0,0 +1,766 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,0:0:0-13:0:121", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,1:0:1-3:1:11", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,1:0:1-1:1:2", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,1:0:1-1:1:2", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,1:3:4-3:1:11", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,2:2:8-2:3:9", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,2:2:8-2:3:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,2:2:8-2:3:9", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,4:0:12-6:1:22", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,4:0:12-4:1:13", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,4:0:12-4:1:13", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,4:3:15-6:1:22", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,5:2:19-5:3:20", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,5:2:19-5:3:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,5:2:19-5:3:20", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:0:23-7:17:40", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:0:23-7:10:33", + "src": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:0:23-7:3:26", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:0:23-7:1:24", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:2:25-7:3:26", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:7:30-7:10:33", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:7:30-7:8:31", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:9:32-7:10:33", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:12:35-7:17:40", + "value": [ + { + "string": "likes", + "raw_string": "likes" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,8:0:41-8:11:52", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,8:0:41-8:2:43", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,8:0:41-8:2:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "primary": {}, + "value": { + "suspension": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,8:4:45-8:11:52", + "value": true + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,9:0:53-9:22:75", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,9:1:54-9:9:62", + "src": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,9:1:54-9:3:56", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,9:1:54-9:3:56", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,9:7:60-9:9:62", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,9:7:60-9:9:62", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "edge_index": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,9:10:63-9:13:66", + "int": null, + "glob": true + }, + "primary": {}, + "value": { + "suspension": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,9:15:68-9:22:75", + "value": true + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:0:76-12:1:120", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:1:77-10:9:85", + "src": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:1:77-10:3:79", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:1:77-10:3:79", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:7:83-10:9:85", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:7:83-10:9:85", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "edge_index": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:10:86-10:13:89", + "int": null, + "glob": true + }, + "primary": { + "suspension": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:15:91-10:24:100", + "value": false + } + }, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,10:25:101-12:1:120", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,11:2:105-11:15:118", + "ampersand": true, + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,11:3:106-11:8:111", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,11:3:106-11:8:111", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,11:10:113-11:15:118", + "value": [ + { + "string": "likes", + "raw_string": "likes" + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "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": [ + { + "index": 0, + "isCurve": false, + "src_arrow": false, + "dst_arrow": true, + "references": [ + { + "map_key_edge_index": 0 + }, + { + "map_key_edge_index": 0 + }, + { + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "likes" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ], + "objects": [ + { + "id": "a", + "id_val": "a", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,1:0:1-1:1:2", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,1:0:1-1:1:2", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:0:23-7:3:26", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:0:23-7:1:24", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:2:25-7:3:26", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "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": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,2:2:8-2:3:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,2:2:8-2:3:9", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:0:23-7:3:26", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:0:23-7:1:24", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:2:25-7:3:26", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + { + "id": "c", + "id_val": "c", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,4:0:12-4:1:13", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,4:0:12-4:1:13", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:7:30-7:10:33", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:7:30-7:8:31", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:9:32-7:10:33", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "c" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + }, + { + "id": "d", + "id_val": "d", + "references": [ + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,5:2:19-5:3:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,5:2:19-5:3:20", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:7:30-7:10:33", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:7:30-7:8:31", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-cross-container-edge-label.d2,7:9:32-7:10:33", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "d" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ] + }, + "err": null +} diff --git a/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.exp.json b/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.exp.json new file mode 100644 index 000000000..c3508fbc6 --- /dev/null +++ b/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.exp.json @@ -0,0 +1,577 @@ +{ + "graph": { + "name": "", + "isFolderOnly": false, + "ast": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,0:0:0-13:0:121", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,1:0:1-3:1:11", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,1:0:1-1:1:2", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,1:0:1-1:1:2", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,1:3:4-3:1:11", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,2:2:8-2:3:9", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,2:2:8-2:3:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,2:2:8-2:3:9", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,4:0:12-6:1:22", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,4:0:12-4:1:13", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,4:0:12-4:1:13", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,4:3:15-6:1:22", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,5:2:19-5:3:20", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,5:2:19-5:3:20", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,5:2:19-5:3:20", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "primary": {}, + "value": {} + } + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:0:23-7:17:40", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:0:23-7:10:33", + "src": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:0:23-7:3:26", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:0:23-7:1:24", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:2:25-7:3:26", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:7:30-7:10:33", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:7:30-7:8:31", + "value": [ + { + "string": "c", + "raw_string": "c" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:9:32-7:10:33", + "value": [ + { + "string": "d", + "raw_string": "d" + } + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:12:35-7:17:40", + "value": [ + { + "string": "likes", + "raw_string": "likes" + } + ] + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,8:0:41-8:11:52", + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,8:0:41-8:2:43", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,8:0:41-8:2:43", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "primary": {}, + "value": { + "suspension": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,8:4:45-8:11:52", + "value": true + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,9:0:53-9:22:75", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,9:1:54-9:9:62", + "src": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,9:1:54-9:3:56", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,9:1:54-9:3:56", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,9:7:60-9:9:62", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,9:7:60-9:9:62", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "edge_index": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,9:10:63-9:13:66", + "int": null, + "glob": true + }, + "primary": {}, + "value": { + "suspension": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,9:15:68-9:22:75", + "value": true + } + } + } + }, + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:0:76-12:1:120", + "edges": [ + { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:1:77-10:9:85", + "src": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:1:77-10:3:79", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:1:77-10:3:79", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "src_arrow": "", + "dst": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:7:83-10:9:85", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:7:83-10:9:85", + "value": [ + { + "string": "**", + "raw_string": "**" + } + ], + "pattern": [ + "*", + "", + "*" + ] + } + } + ] + }, + "dst_arrow": ">" + } + ], + "edge_index": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:10:86-10:13:89", + "int": null, + "glob": true + }, + "primary": { + "suspension": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:15:91-10:24:100", + "value": false + } + }, + "value": { + "map": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,10:25:101-12:1:120", + "nodes": [ + { + "map_key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,11:2:105-11:15:118", + "ampersand": true, + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,11:3:106-11:8:111", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,11:3:106-11:8:111", + "value": [ + { + "string": "label", + "raw_string": "label" + } + ] + } + } + ] + }, + "primary": {}, + "value": { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,11:10:113-11:15:118", + "value": [ + { + "string": "likes", + "raw_string": "likes" + } + ] + } + } + } + } + ] + } + } + } + } + ] + }, + "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/TestCompile2/globs/unsuspend-edge-label#01.d2,1:0:1-1:1:2", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,1:0:1-1:1:2", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:0:23-7:3:26", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:0:23-7:1:24", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:2:25-7:3:26", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": 0 + } + ], + "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": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,2:2:8-2:3:9", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,2:2:8-2:3:9", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 0, + "map_key_edge_index": -1 + }, + { + "key": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:0:23-7:3:26", + "path": [ + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:0:23-7:1:24", + "value": [ + { + "string": "a", + "raw_string": "a" + } + ] + } + }, + { + "unquoted_string": { + "range": "d2/testdata/d2compiler/TestCompile2/globs/unsuspend-edge-label#01.d2,7:2:25-7:3:26", + "value": [ + { + "string": "b", + "raw_string": "b" + } + ] + } + } + ] + }, + "key_path_index": 1, + "map_key_edge_index": 0 + } + ], + "attributes": { + "label": { + "value": "b" + }, + "labelDimensions": { + "width": 0, + "height": 0 + }, + "style": {}, + "near_key": null, + "shape": { + "value": "rectangle" + }, + "direction": { + "value": "" + }, + "constraint": null + }, + "zIndex": 0 + } + ] + }, + "err": null +}