diff options
author | Alessandro Arzilli <alessandro.arzilli@gmail.com> | 2019-08-19 16:15:39 +0200 |
---|---|---|
committer | alandonovan <adonovan@google.com> | 2019-08-19 10:15:39 -0400 |
commit | 688506ed52c2f107b2f10d1263438162dc0e2e31 (patch) | |
tree | a37d708e41bfca9ab8c2f94654d3dcd14833f3a5 /internal/compile/compile.go | |
parent | 1a17001102fea066bf4cfde278db20cbd87c5163 (diff) | |
download | starlark-go-688506ed52c2f107b2f10d1263438162dc0e2e31.tar.gz |
starlark,resolve,internal/compile: replace log.Fatalf with log.Panicf (#235)
Replace calls to log.Fatal/log.Fatalf with log.Panicf calls so that we
get a stacktrace.
Diffstat (limited to 'internal/compile/compile.go')
-rw-r--r-- | internal/compile/compile.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/compile/compile.go b/internal/compile/compile.go index f7b44c9..eb8e162 100644 --- a/internal/compile/compile.go +++ b/internal/compile/compile.go @@ -1000,7 +1000,7 @@ func (fcomp *fcomp) set(id *syntax.Ident) { case resolve.Global: fcomp.emit1(SETGLOBAL, uint32(bind.Index)) default: - log.Fatalf("%s: set(%s): not global/local/cell (%d)", id.NamePos, id.Name, bind.Scope) + log.Panicf("%s: set(%s): not global/local/cell (%d)", id.NamePos, id.Name, bind.Scope) } } @@ -1028,7 +1028,7 @@ func (fcomp *fcomp) lookup(id *syntax.Ident) { case resolve.Universal: fcomp.emit1(UNIVERSAL, fcomp.pcomp.nameIndex(id.Name)) default: - log.Fatalf("%s: compiler.lookup(%s): scope = %d", id.NamePos, id.Name, bind.Scope) + log.Panicf("%s: compiler.lookup(%s): scope = %d", id.NamePos, id.Name, bind.Scope) } } @@ -1224,7 +1224,7 @@ func (fcomp *fcomp) stmt(stmt syntax.Stmt) { default: start, _ := stmt.Span() - log.Fatalf("%s: exec: unexpected statement %T", start, stmt) + log.Panicf("%s: exec: unexpected statement %T", start, stmt) } } @@ -1374,7 +1374,7 @@ func (fcomp *fcomp) expr(e syntax.Expr) { case syntax.TILDE: fcomp.emit(TILDE) default: - log.Fatalf("%s: unexpected unary op: %s", e.OpPos, e.Op) + log.Panicf("%s: unexpected unary op: %s", e.OpPos, e.Op) } case *syntax.BinaryExpr: @@ -1436,7 +1436,7 @@ func (fcomp *fcomp) expr(e syntax.Expr) { default: start, _ := e.Span() - log.Fatalf("%s: unexpected expr %T", start, e) + log.Panicf("%s: unexpected expr %T", start, e) } } @@ -1619,7 +1619,7 @@ func (fcomp *fcomp) binop(pos syntax.Position, op syntax.Token) { fcomp.emit(Opcode(op-syntax.EQL) + EQL) default: - log.Fatalf("%s: unexpected binary op: %s", pos, op) + log.Panicf("%s: unexpected binary op: %s", pos, op) } } @@ -1778,7 +1778,7 @@ func (fcomp *fcomp) comprehension(comp *syntax.Comprehension, clauseIndex int) { } start, _ := clause.Span() - log.Fatalf("%s: unexpected comprehension clause %T", start, clause) + log.Panicf("%s: unexpected comprehension clause %T", start, clause) } func (fcomp *fcomp) function(f *resolve.Function) { |