Skip to content

Commit a646bd9

Browse files
authored
Save AST in compiled program (#268)
1 parent 70ceebb commit a646bd9

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

compiler/compiler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func Compile(tree *parser.Tree, config *conf.Config) (program *Program, err erro
4444
}
4545

4646
program = &Program{
47+
Node: tree.Node,
4748
Source: tree.Source,
4849
Locations: c.locations,
4950
Constants: c.constants,

vm/program.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import (
44
"fmt"
55
"regexp"
66

7+
"github.com/antonmedv/expr/ast"
78
"github.com/antonmedv/expr/file"
89
"github.com/antonmedv/expr/vm/runtime"
910
)
1011

1112
type Program struct {
13+
Node ast.Node
1214
Source *file.Source
1315
Locations []file.Location
1416
Constants []interface{}

0 commit comments

Comments
 (0)