summaryrefslogtreecommitdiff
path: root/src/pkg/exp
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2010-03-24 16:46:53 -0700
committerRob Pike <r@golang.org>2010-03-24 16:46:53 -0700
commit420d470e6ef507a6183e49c42f04051349803487 (patch)
tree19bab8994a6a628a1309f01d31a9809d6f6ac5be /src/pkg/exp
parente2854b2f5f4789b20941f5b35082d9fa33c152e3 (diff)
downloadgolang-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')
-rw-r--r--src/pkg/exp/eval/abort.go2
-rw-r--r--src/pkg/exp/eval/expr.go9
-rw-r--r--src/pkg/exp/eval/type.go2
3 files changed, 6 insertions, 7 deletions
diff --git a/src/pkg/exp/eval/abort.go b/src/pkg/exp/eval/abort.go
index bfa89fa29..22e17cec4 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 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"))
diff --git a/src/pkg/exp/eval/type.go b/src/pkg/exp/eval/type.go
index 55a09603e..2b2a632cd 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)
}