Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Jul 11, 2023
1 parent 741a9aa commit b193b9b
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 38 deletions.
6 changes: 0 additions & 6 deletions d2ast/d2ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ func (s *BlockString) value() {}
func (a *Array) value() {}
func (m *Map) value() {}
func (i *Import) value() {}
func (i *Substitution) value() {}

func (n *Null) scalar() {}
func (b *Boolean) scalar() {}
Expand Down Expand Up @@ -924,7 +923,6 @@ type ValueBox struct {
Array *Array `json:"array,omitempty"`
Map *Map `json:"map,omitempty"`
Import *Import `json:"import,omitempty"`
Substitution *Substitution `json:"substitution,omitempty"`
}

func (vb ValueBox) Unbox() Value {
Expand All @@ -949,8 +947,6 @@ func (vb ValueBox) Unbox() Value {
return vb.Map
case vb.Import != nil:
return vb.Import
case vb.Substitution != nil:
return vb.Substitution
default:
return nil
}
Expand Down Expand Up @@ -979,8 +975,6 @@ func MakeValueBox(v Value) ValueBox {
vb.Map = v
case *Import:
vb.Import = v
case *Substitution:
vb.Substitution = v
}
return vb
}
Expand Down
6 changes: 0 additions & 6 deletions d2ir/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ func (c *compiler) resolveSubstitutions(refctx *RefContext) {
}

switch {
case refctx.Key.Value.Substitution != nil:
resolvedField := c.resolveSubstitution(varsMap, refctx.Key, refctx.Key.Value.Substitution)
if resolvedField != nil {
refctx.Key.Value = d2ast.MakeValueBox(resolvedField.Primary().Value)
}
case refctx.Key.Value.UnquotedString != nil:
for i, box := range refctx.Key.Value.UnquotedString.Value {
if box.Substitution != nil {
Expand Down Expand Up @@ -245,7 +240,6 @@ func (c *compiler) compileMap(dst *Map, ast, scopeAST *d2ast.Map) {
}

func (c *compiler) compileKey(refctx *RefContext) {
// resolve substitutions here
c.resolveSubstitutions(refctx)
if len(refctx.Key.Edges) == 0 {
c.compileField(refctx.ScopeMap, refctx.Key.Key, refctx)
Expand Down
3 changes: 0 additions & 3 deletions d2parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -1596,9 +1596,6 @@ func (p *parser) parseValue() d2ast.ValueBox {
case '@':
box.Import = p.parseImport(false)
return box
case '$':
box.Substitution = p.parseSubstitution(false)
return box
}

p.replay(r)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testdata/d2compiler/TestCompile2/vars/basic/label.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions testdata/d2compiler/TestCompile2/vars/basic/number.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testdata/d2compiler/TestCompile2/vars/basic/style.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions testdata/d2compiler/TestCompile2/vars/boards/layer.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions testdata/d2compiler/TestCompile2/vars/boards/overlay.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions testdata/d2compiler/TestCompile2/vars/boards/replace.exp.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b193b9b

Please sign in to comment.