diff options
author | Rob Pike <r@golang.org> | 2010-03-24 16:46:53 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2010-03-24 16:46:53 -0700 |
commit | 420d470e6ef507a6183e49c42f04051349803487 (patch) | |
tree | 19bab8994a6a628a1309f01d31a9809d6f6ac5be /src/pkg/exp/eval/expr.go | |
parent | e2854b2f5f4789b20941f5b35082d9fa33c152e3 (diff) | |
download | golang-420d470e6ef507a6183e49c42f04051349803487.tar.gz |
delete all uses of panicln by rewriting them using panic or,
in the tests, println+panic.
gofmt some tests too.
R=rsc
CC=golang-dev
http://codereview.appspot.com/741041
Diffstat (limited to 'src/pkg/exp/eval/expr.go')
-rw-r--r-- | src/pkg/exp/eval/expr.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pkg/exp/eval/expr.go b/src/pkg/exp/eval/expr.go index dcd02abc2..5547aee31 100644 --- a/src/pkg/exp/eval/expr.go +++ b/src/pkg/exp/eval/expr.go @@ -6,6 +6,7 @@ package eval import ( "bignum" + "fmt" "go/ast" "go/token" "log" @@ -340,7 +341,7 @@ func (a *assignCompiler) compile(b *block, lt Type) func(Value, *Thread) { temp := b.DefineTemp(a.rmt) tempIdx := temp.Index if tempIdx < 0 { - panicln("tempidx", tempIdx) + panic(fmt.Sprintln("tempidx", tempIdx)) } if a.isMapUnpack { rf := a.rs[0].evalMapValue @@ -1374,12 +1375,12 @@ func (a *exprInfo) compileBuiltinCallExpr(b *block, ft *FuncType, as []*expr) *e expr.eval = func(*Thread) Value { return t.Zero() } return expr - case panicType, paniclnType, printType, printlnType: + case panicType, printType, printlnType: evals := make([]func(*Thread) interface{}, len(as)) for i, x := range as { evals[i] = x.asInterface() } - spaces := ft == paniclnType || ft == printlnType + spaces := ft == printlnType newline := ft != printType printer := func(t *Thread) { for i, eval := range evals { @@ -1413,7 +1414,7 @@ func (a *exprInfo) compileBuiltinCallExpr(b *block, ft *FuncType, as []*expr) *e } expr := a.newExpr(EmptyType, "print") expr.exec = printer - if ft == panicType || ft == paniclnType { + if ft == panicType { expr.exec = func(t *Thread) { printer(t) t.Abort(os.NewError("panic")) |