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 | 325cf8ef217b4e9ae2caf53fa0d4534cd5003bd8 (patch) | |
| tree | 72405fbc32b0bef0850cac2797f818bccc12b44e /src/pkg/exp/eval | |
| parent | acfd6d5f055ca5283dff5de16390c1d0cfc9f0ca (diff) | |
| download | go-325cf8ef217b4e9ae2caf53fa0d4534cd5003bd8.tar.xz | |
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
https://golang.org/cl/741041
Diffstat (limited to 'src/pkg/exp/eval')
| -rw-r--r-- | src/pkg/exp/eval/abort.go | 2 | ||||
| -rw-r--r-- | src/pkg/exp/eval/expr.go | 9 | ||||
| -rw-r--r-- | src/pkg/exp/eval/type.go | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/pkg/exp/eval/abort.go b/src/pkg/exp/eval/abort.go index bfa89fa299..22e17cec40 100644 --- a/src/pkg/exp/eval/abort.go +++ b/src/pkg/exp/eval/abort.go @@ -14,7 +14,7 @@ import ( // causing the innermost Try to return err. func (t *Thread) Abort(err os.Error) { if t.abort == nil { - panicln("abort:", err.String()) + panic("abort: " + err.String()) } t.abort <- err runtime.Goexit() diff --git a/src/pkg/exp/eval/expr.go b/src/pkg/exp/eval/expr.go index dcd02abc2c..5547aee319 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")) diff --git a/src/pkg/exp/eval/type.go b/src/pkg/exp/eval/type.go index 55a09603e3..2b2a632cd0 100644 --- a/src/pkg/exp/eval/type.go +++ b/src/pkg/exp/eval/type.go @@ -702,7 +702,6 @@ var ( makeType = &FuncType{builtin: "make"} newType = &FuncType{builtin: "new"} panicType = &FuncType{builtin: "panic"} - paniclnType = &FuncType{builtin: "panicln"} printType = &FuncType{builtin: "print"} printlnType = &FuncType{builtin: "println"} ) @@ -1237,7 +1236,6 @@ func init() { universe.DefineConst("make", universePos, makeType, nil) universe.DefineConst("new", universePos, newType, nil) universe.DefineConst("panic", universePos, panicType, nil) - universe.DefineConst("panicln", universePos, paniclnType, nil) universe.DefineConst("print", universePos, printType, nil) universe.DefineConst("println", universePos, printlnType, nil) } |
