fix var panic
This commit is contained in:
parent
f277522b2a
commit
cc1e647dfc
2 changed files with 61 additions and 0 deletions
|
|
@ -1134,6 +1134,10 @@ func (c *compiler) extendLinks(m *Map, importF *Field, importDir string) {
|
||||||
nodeBoardKind := NodeBoardKind(m)
|
nodeBoardKind := NodeBoardKind(m)
|
||||||
importIDA := IDA(importF)
|
importIDA := IDA(importF)
|
||||||
for _, f := range m.Fields {
|
for _, f := range m.Fields {
|
||||||
|
// A substitute or such
|
||||||
|
if f.Name == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if f.Name.ScalarString() == "link" && f.Name.IsUnquoted() {
|
if f.Name.ScalarString() == "link" && f.Name.IsUnquoted() {
|
||||||
if nodeBoardKind != "" {
|
if nodeBoardKind != "" {
|
||||||
c.errorf(f.LastRef().AST(), "a board itself cannot be linked; only objects within a board can be linked")
|
c.errorf(f.LastRef().AST(), "a board itself cannot be linked; only objects within a board can be linked")
|
||||||
|
|
|
||||||
57
testdata/d2compiler/TestCompile/import-var-chain.exp.json
generated
vendored
Normal file
57
testdata/d2compiler/TestCompile/import-var-chain.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"name": "",
|
||||||
|
"isFolderOnly": true,
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-var-chain.d2,0:0:0-1:0:8",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"import": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-var-chain.d2,0:0:0-0:7:7",
|
||||||
|
"spread": true,
|
||||||
|
"pre": "",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/import-var-chain.d2,0:4:4-0:7:7",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "dev",
|
||||||
|
"raw_string": "dev"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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": null
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue