fix bad import syntax edge case
This commit is contained in:
parent
02143580b6
commit
6272d3e8b1
2 changed files with 3 additions and 1 deletions
|
|
@ -3,3 +3,5 @@
|
|||
#### Improvements 🧹
|
||||
|
||||
#### Bugfixes ⛑️
|
||||
|
||||
- Fixes edge case of bad import syntax crashing using d2 as a library [1829](https://github.com/terrastruct/d2/pull/1829)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
func (c *compiler) pushImportStack(imp *d2ast.Import) (string, bool) {
|
||||
impPath := imp.PathWithPre()
|
||||
if impPath == "" && imp.Range.Path != "" {
|
||||
if impPath == "" && imp.Range != (d2ast.Range{}) {
|
||||
c.errorf(imp, "imports must specify a path to import")
|
||||
return "", false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue