expose import stack
This commit is contained in:
parent
fa98423492
commit
336789c93f
4 changed files with 6 additions and 6 deletions
|
|
@ -40,7 +40,7 @@ func Compile(p string, r io.Reader, opts *CompileOptions) (*d2graph.Graph, *d2ta
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
ir, err := d2ir.Compile(ast, &d2ir.CompileOptions{
|
||||
ir, _, err := d2ir.Compile(ast, &d2ir.CompileOptions{
|
||||
UTF16Pos: opts.UTF16Pos,
|
||||
FS: opts.FS,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func (c *compiler) errorf(n d2ast.Node, f string, v ...interface{}) {
|
|||
c.err.Errors = append(c.err.Errors, d2parser.Errorf(n, f, v...).(d2ast.Error))
|
||||
}
|
||||
|
||||
func Compile(ast *d2ast.Map, opts *CompileOptions) (*Map, error) {
|
||||
func Compile(ast *d2ast.Map, opts *CompileOptions) (*Map, []string, error) {
|
||||
if opts == nil {
|
||||
opts = &CompileOptions{}
|
||||
}
|
||||
|
|
@ -78,9 +78,9 @@ func Compile(ast *d2ast.Map, opts *CompileOptions) (*Map, error) {
|
|||
c.compileSubstitutions(m, nil)
|
||||
c.overlayClasses(m)
|
||||
if !c.err.Empty() {
|
||||
return nil, c.err
|
||||
return nil, nil, c.err
|
||||
}
|
||||
return m, nil
|
||||
return m, c.importStack, nil
|
||||
}
|
||||
|
||||
func (c *compiler) overlayClasses(m *Map) {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func compileFS(t testing.TB, path string, mfs map[string]string) (*d2ir.Map, err
|
|||
err = fs.Close()
|
||||
assert.Success(t, err)
|
||||
})
|
||||
m, err := d2ir.Compile(ast, &d2ir.CompileOptions{
|
||||
m, _, err := d2ir.Compile(ast, &d2ir.CompileOptions{
|
||||
FS: fs,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ func _set(g *d2graph.Graph, baseAST *d2ast.Map, key string, tag, value *string)
|
|||
return nil
|
||||
}
|
||||
}
|
||||
ir, err := d2ir.Compile(g.AST, &d2ir.CompileOptions{
|
||||
ir, _, err := d2ir.Compile(g.AST, &d2ir.CompileOptions{
|
||||
FS: g.FS,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue