move edge check
This commit is contained in:
parent
29af92310b
commit
f12f9ca69d
2 changed files with 9 additions and 5 deletions
|
|
@ -278,11 +278,11 @@ func (c *compiler) compileField(obj *d2graph.Object, f *d2ir.Field) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else if f.Name == "vars" {
|
} else if f.Name == "vars" {
|
||||||
if f.Map() != nil {
|
// if f.Map() != nil {
|
||||||
if len(f.Map().Edges) > 0 {
|
// if len(f.Map().Edges) > 0 {
|
||||||
c.errorf(f.Map().Edges[0].LastRef().AST(), "vars cannot contain an edge")
|
// c.errorf(f.Map().Edges[0].LastRef().AST(), "vars cannot contain an edge")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return
|
return
|
||||||
} else if isReserved {
|
} else if isReserved {
|
||||||
c.compileReserved(&obj.Attributes, f)
|
c.compileReserved(&obj.Attributes, f)
|
||||||
|
|
|
||||||
|
|
@ -523,6 +523,10 @@ func (c *compiler) compileLink(refctx *RefContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *compiler) compileEdges(refctx *RefContext) {
|
func (c *compiler) compileEdges(refctx *RefContext) {
|
||||||
|
if IsVar(refctx.ScopeMap) {
|
||||||
|
c.errorf(refctx.Key, "vars cannot contain an edge")
|
||||||
|
return
|
||||||
|
}
|
||||||
if refctx.Key.Key != nil {
|
if refctx.Key.Key != nil {
|
||||||
f, err := refctx.ScopeMap.EnsureField(refctx.Key.Key, refctx)
|
f, err := refctx.ScopeMap.EnsureField(refctx.Key.Key, refctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue