Skip to content

Commit

Permalink
move edge check
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Jul 13, 2023
1 parent 29af923 commit f12f9ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions d2compiler/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ func (c *compiler) compileField(obj *d2graph.Object, f *d2ir.Field) {
}
return
} else if f.Name == "vars" {
if f.Map() != nil {
if len(f.Map().Edges) > 0 {
c.errorf(f.Map().Edges[0].LastRef().AST(), "vars cannot contain an edge")
}
}
// if f.Map() != nil {
// if len(f.Map().Edges) > 0 {
// c.errorf(f.Map().Edges[0].LastRef().AST(), "vars cannot contain an edge")
// }
// }
return
} else if isReserved {
c.compileReserved(&obj.Attributes, f)
Expand Down
4 changes: 4 additions & 0 deletions d2ir/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ func (c *compiler) compileLink(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 {
f, err := refctx.ScopeMap.EnsureField(refctx.Key.Key, refctx)
if err != nil {
Expand Down

0 comments on commit f12f9ca

Please sign in to comment.