fix &leaf filter

This commit is contained in:
Alexander Wang 2025-02-04 17:32:45 -07:00
parent 14ef2552a8
commit 97cbd76178
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
4 changed files with 735 additions and 33 deletions

View file

@ -5212,21 +5212,55 @@ y.link: https://google.com
},
},
{
name: "leaf-filter",
name: "leaf-filter-1",
run: func(t *testing.T) {
g, _ := assertCompile(t, `
**: {
&leaf: false
style.fill: red
}
**: {
&leaf: true
style.stroke: yellow
}
a.b.c
`, ``)
assert.Equal(t, "a", g.Objects[0].ID)
assert.Equal(t, "red", g.Objects[0].Attributes.Style.Fill.Value)
assert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[0].Attributes.Style.Stroke)
assert.Equal(t, "b", g.Objects[1].ID)
assert.Equal(t, "red", g.Objects[1].Attributes.Style.Fill.Value)
assert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[1].Attributes.Style.Stroke)
assert.Equal(t, "c", g.Objects[2].ID)
assert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[2].Attributes.Style.Fill)
assert.Equal(t, "yellow", g.Objects[2].Attributes.Style.Stroke.Value)
},
},
{
name: "leaf-filter-2",
run: func(t *testing.T) {
g, _ := assertCompile(t, `
**: {
&leaf: true
style.stroke: yellow
}
a: {
b -> c
}
d: {
e
}
`, ``)
assert.Equal(t, "a", g.Objects[0].ID)
assert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[0].Attributes.Style.Stroke)
assert.Equal(t, "b", g.Objects[1].ID)
assert.Equal(t, "yellow", g.Objects[1].Attributes.Style.Stroke.Value)
assert.Equal(t, "c", g.Objects[2].ID)
assert.Equal(t, "yellow", g.Objects[2].Attributes.Style.Stroke.Value)
assert.Equal(t, "d", g.Objects[3].ID)
assert.Equal(t, (*d2graph.Scalar)(nil), g.Objects[3].Attributes.Style.Stroke)
assert.Equal(t, "e", g.Objects[4].ID)
assert.Equal(t, "yellow", g.Objects[4].Attributes.Style.Stroke.Value)
},
},
{

View file

@ -673,6 +673,23 @@ func (m *Map) IsContainer() bool {
if m == nil {
return false
}
// Check references as the fields and edges may not be compiled yet
f := m.Parent().(*Field)
for _, ref := range f.References {
if ref.Primary() && ref.Context_.Key != nil && ref.Context_.Key.Value.Map != nil {
for _, n := range ref.Context_.Key.Value.Map.Nodes {
if len(n.MapKey.Edges) > 0 {
return true
}
if n.MapKey.Key != nil {
_, isReserved := d2ast.ReservedKeywords[n.MapKey.Key.Path[0].Unbox().ScalarString()]
if !(isReserved && f.Name.IsUnquoted()) {
return true
}
}
}
}
}
for _, f := range m.Fields {
_, isReserved := d2ast.ReservedKeywords[f.Name.ScalarString()]
if !(isReserved && f.Name.IsUnquoted()) {

View file

@ -3,17 +3,17 @@
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,0:0:0-6:0:48",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,0:0:0-10:0:93",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,1:0:1-4:1:41",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,1:0:1-4:1:41",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,1:0:1-1:2:3",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,1:0:1-1:2:3",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,1:0:1-1:2:3",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,1:0:1-1:2:3",
"value": [
{
"string": "**",
@ -32,18 +32,18 @@
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,1:4:5-4:1:41",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,1:4:5-4:1:41",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,2:2:9-2:14:21",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,2:2:9-2:14:21",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,2:3:10-2:7:14",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,2:3:10-2:7:14",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,2:3:10-2:7:14",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,2:3:10-2:7:14",
"value": [
{
"string": "leaf",
@ -57,7 +57,7 @@
"primary": {},
"value": {
"boolean": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,2:9:16-2:14:21",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,2:9:16-2:14:21",
"value": false
}
}
@ -65,13 +65,13 @@
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,3:2:24-3:17:39",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,3:2:24-3:17:39",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,3:2:24-3:12:34",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,3:2:24-3:12:34",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,3:2:24-3:7:29",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,3:2:24-3:7:29",
"value": [
{
"string": "style",
@ -82,7 +82,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,3:8:30-3:12:34",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,3:8:30-3:12:34",
"value": [
{
"string": "fill",
@ -96,7 +96,7 @@
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,3:14:36-3:17:39",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,3:14:36-3:17:39",
"value": [
{
"string": "red",
@ -114,13 +114,120 @@
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,5:0:42-8:1:86",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,5:0:42-5:2:44",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:1:43",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,5:0:42-5:2:44",
"value": [
{
"string": "**",
"raw_string": "**"
}
],
"pattern": [
"*",
"",
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,5:4:46-8:1:86",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,6:2:50-6:13:61",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,6:3:51-6:7:55",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,6:3:51-6:7:55",
"value": [
{
"string": "leaf",
"raw_string": "leaf"
}
]
}
}
]
},
"primary": {},
"value": {
"boolean": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,6:9:57-6:13:61",
"value": true
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,7:2:64-7:22:84",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,7:2:64-7:14:76",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,7:2:64-7:7:69",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,7:8:70-7:14:76",
"value": [
{
"string": "stroke",
"raw_string": "stroke"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,7:16:78-7:22:84",
"value": [
{
"string": "yellow",
"raw_string": "yellow"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:5:92",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:5:92",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:1:88",
"value": [
{
"string": "a",
@ -131,7 +238,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:2:44-5:3:45",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:2:89-9:3:90",
"value": [
{
"string": "b",
@ -142,7 +249,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:4:46-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:4:91-9:5:92",
"value": [
{
"string": "c",
@ -190,11 +297,11 @@
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:5:92",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:1:43",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:1:88",
"value": [
{
"string": "a",
@ -205,7 +312,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:2:44-5:3:45",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:2:89-9:3:90",
"value": [
{
"string": "b",
@ -216,7 +323,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:4:46-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:4:91-9:5:92",
"value": [
{
"string": "c",
@ -261,11 +368,11 @@
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:5:92",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:1:43",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:1:88",
"value": [
{
"string": "a",
@ -276,7 +383,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:2:44-5:3:45",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:2:89-9:3:90",
"value": [
{
"string": "b",
@ -287,7 +394,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:4:46-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:4:91-9:5:92",
"value": [
{
"string": "c",
@ -332,11 +439,11 @@
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:5:92",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:0:42-5:1:43",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:0:87-9:1:88",
"value": [
{
"string": "a",
@ -347,7 +454,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:2:44-5:3:45",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:2:89-9:3:90",
"value": [
{
"string": "b",
@ -358,7 +465,7 @@
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter.d2,5:4:46-5:5:47",
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-1.d2,9:4:91-9:5:92",
"value": [
{
"string": "c",
@ -381,7 +488,11 @@
"width": 0,
"height": 0
},
"style": {},
"style": {
"stroke": {
"value": "yellow"
}
},
"near_key": null,
"shape": {
"value": "rectangle"

View file

@ -0,0 +1,540 @@
{
"graph": {
"name": "",
"isFolderOnly": false,
"ast": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,0:0:0-11:0:73",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,1:0:1-4:1:45",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,1:0:1-1:2:3",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,1:0:1-1:2:3",
"value": [
{
"string": "**",
"raw_string": "**"
}
],
"pattern": [
"*",
"",
"*"
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,1:4:5-4:1:45",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,2:2:9-2:13:20",
"ampersand": true,
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,2:3:10-2:7:14",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,2:3:10-2:7:14",
"value": [
{
"string": "leaf",
"raw_string": "leaf"
}
]
}
}
]
},
"primary": {},
"value": {
"boolean": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,2:9:16-2:13:20",
"value": true
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,3:2:23-3:22:43",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,3:2:23-3:14:35",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,3:2:23-3:7:28",
"value": [
{
"string": "style",
"raw_string": "style"
}
]
}
},
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,3:8:29-3:14:35",
"value": [
{
"string": "stroke",
"raw_string": "stroke"
}
]
}
}
]
},
"primary": {},
"value": {
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,3:16:37-3:22:43",
"value": [
{
"string": "yellow",
"raw_string": "yellow"
}
]
}
}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,5:0:46-7:1:61",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,5:0:46-5:1:47",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,5:0:46-5:1:47",
"value": [
{
"string": "a",
"raw_string": "a"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,5:3:49-7:1:61",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:2:53-6:8:59",
"edges": [
{
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:2:53-6:8:59",
"src": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:2:53-6:3:54",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:2:53-6:3:54",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"src_arrow": "",
"dst": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:7:58-6:8:59",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:7:58-6:8:59",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
}
]
},
"dst_arrow": ">"
}
],
"primary": {},
"value": {}
}
}
]
}
}
}
},
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,8:0:62-10:1:72",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,8:0:62-8:1:63",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,8:0:62-8:1:63",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
}
]
},
"primary": {},
"value": {
"map": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,8:3:65-10:1:72",
"nodes": [
{
"map_key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,9:2:69-9:3:70",
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,9:2:69-9:3:70",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,9:2:69-9:3:70",
"value": [
{
"string": "e",
"raw_string": "e"
}
]
}
}
]
},
"primary": {},
"value": {}
}
}
]
}
}
}
}
]
},
"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
}
],
"attributes": {
"label": {
"value": ""
},
"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/leaf-filter-2.d2,5:0:46-5:1:47",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,5:0:46-5:1:47",
"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": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:2:53-6:3:54",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:2:53-6:3:54",
"value": [
{
"string": "b",
"raw_string": "b"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "b"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "yellow"
}
},
"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/leaf-filter-2.d2,6:7:58-6:8:59",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,6:7:58-6:8:59",
"value": [
{
"string": "c",
"raw_string": "c"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": 0
}
],
"attributes": {
"label": {
"value": "c"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "yellow"
}
},
"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/leaf-filter-2.d2,8:0:62-8:1:63",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,8:0:62-8:1:63",
"value": [
{
"string": "d",
"raw_string": "d"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "d"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
},
{
"id": "e",
"id_val": "e",
"references": [
{
"key": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,9:2:69-9:3:70",
"path": [
{
"unquoted_string": {
"range": "d2/testdata/d2compiler/TestCompile2/globs/leaf-filter-2.d2,9:2:69-9:3:70",
"value": [
{
"string": "e",
"raw_string": "e"
}
]
}
}
]
},
"key_path_index": 0,
"map_key_edge_index": -1
}
],
"attributes": {
"label": {
"value": "e"
},
"labelDimensions": {
"width": 0,
"height": 0
},
"style": {
"stroke": {
"value": "yellow"
}
},
"near_key": null,
"shape": {
"value": "rectangle"
},
"direction": {
"value": ""
},
"constraint": null
},
"zIndex": 0
}
]
},
"err": null
}