aboutsummaryrefslogtreecommitdiff
path: root/ast.go
diff options
context:
space:
mode:
authorFumitoshi Ukai <fumitoshi.ukai@gmail.com>2015-04-18 00:11:05 +0900
committerFumitoshi Ukai <fumitoshi.ukai@gmail.com>2015-04-18 00:12:12 +0900
commit00178d1c2dd6e8d426cc4c7425a5d43273514d2b (patch)
treefa5f20010036b8effde33b4c64e0d807a627464d /ast.go
parent2ffad63581a5ab18bdb0c00b3bc84895d3d58713 (diff)
downloadkati-00178d1c2dd6e8d426cc4c7425a5d43273514d2b.tar.gz
minor performance tuning
before: % ./run_integration_test.rb android Running make for android... 5.76 secs Running kati for android... 17.29 secs android: OK PASS! after: % ./run_integration_test.rb android Running make for android... 5.83 secs Running kati for android... 14.55 secs android: OK PASS!
Diffstat (limited to 'ast.go')
-rw-r--r--ast.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/ast.go b/ast.go
index b190536..678f2b0 100644
--- a/ast.go
+++ b/ast.go
@@ -36,7 +36,11 @@ func (ast *AssignAST) evalRHS(ev *Evaluator, lhs string) Var {
}
switch ast.op {
case ":=":
- return SimpleVar{value: ev.evalExprBytes(ast.rhs), origin: origin}
+ rexpr, _, err := parseExpr([]byte(ast.rhs), nil)
+ if err != nil {
+ panic(fmt.Errorf("parse assign rhs %s:%d %v", ast.filename, ast.lineno, err))
+ }
+ return SimpleVar{value: ev.Value(rexpr), origin: origin}
case "=":
v, _, err := parseExpr([]byte(ast.rhs), nil)
if err != nil {