reappear works
This commit is contained in:
parent
48bb6df3fe
commit
6749115ce2
3 changed files with 94 additions and 2 deletions
|
|
@ -250,7 +250,6 @@ func (c *compiler) compileMap(obj *d2graph.Object, m *d2ir.Map) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *compiler) compileField(obj *d2graph.Object, f *d2ir.Field) {
|
func (c *compiler) compileField(obj *d2graph.Object, f *d2ir.Field) {
|
||||||
println("\033[1;31m--- DEBUG:", "=======================", "\033[m")
|
|
||||||
keyword := strings.ToLower(f.Name)
|
keyword := strings.ToLower(f.Name)
|
||||||
_, isStyleReserved := d2graph.StyleKeywords[keyword]
|
_, isStyleReserved := d2graph.StyleKeywords[keyword]
|
||||||
if isStyleReserved {
|
if isStyleReserved {
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,13 @@ func (c *compiler) compileField(dst *Map, kp *d2ast.KeyPath, refctx *RefContext)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f.Primary() != nil {
|
||||||
|
// null only applies if it's the appearance
|
||||||
|
if _, ok := f.Primary().Value.(*d2ast.Null); ok {
|
||||||
|
f.Primary_ = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if refctx.Key.Primary.Unbox() != nil {
|
if refctx.Key.Primary.Unbox() != nil {
|
||||||
f.Primary_ = &Scalar{
|
f.Primary_ = &Scalar{
|
||||||
parent: f,
|
parent: f,
|
||||||
|
|
|
||||||
88
testdata/d2compiler/TestCompile2/nulls/reappear/shape.exp.json
generated
vendored
88
testdata/d2compiler/TestCompile2/nulls/reappear/shape.exp.json
generated
vendored
|
|
@ -104,7 +104,93 @@
|
||||||
"zIndex": 0
|
"zIndex": 0
|
||||||
},
|
},
|
||||||
"edges": null,
|
"edges": null,
|
||||||
"objects": null
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "a",
|
||||||
|
"id_val": "a",
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/nulls/reappear/shape.d2,1:0:1-1:1:2",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/nulls/reappear/shape.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/nulls/reappear/shape.d2,2:0:3-2:1:4",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/nulls/reappear/shape.d2,2:0:3-2:1:4",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": -1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/nulls/reappear/shape.d2,3:0:11-3:1:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile2/nulls/reappear/shape.d2,3:0:11-3:1:12",
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"err": null
|
"err": null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue