Skip to content

Commit 3313dec

Browse files
committed
compiler,runtime: make panic functions camelCase
Rename panic functions to be runtime.nilPanic, runtime.lookupPanic, and runtime.slicePanic.
1 parent 191a076 commit 3313dec

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

compiler/asserts.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (c *Compiler) emitLookupBoundsCheck(frame *Frame, arrayLen, index llvm.Valu
4242

4343
// Fail: this is a nil pointer, exit with a panic.
4444
c.builder.SetInsertPointAtEnd(faultBlock)
45-
c.createRuntimeCall("lookuppanic", nil, "")
45+
c.createRuntimeCall("lookupPanic", nil, "")
4646
c.builder.CreateUnreachable()
4747

4848
// Ok: this is a valid pointer.
@@ -103,7 +103,7 @@ func (c *Compiler) emitSliceBoundsCheck(frame *Frame, capacity, low, high llvm.V
103103

104104
// Fail: this is a nil pointer, exit with a panic.
105105
c.builder.SetInsertPointAtEnd(faultBlock)
106-
c.createRuntimeCall("slicepanic", nil, "")
106+
c.createRuntimeCall("slicePanic", nil, "")
107107
c.builder.CreateUnreachable()
108108

109109
// Ok: this is a valid pointer.
@@ -146,7 +146,7 @@ func (c *Compiler) emitNilCheck(frame *Frame, ptr llvm.Value, blockPrefix string
146146

147147
// Fail: this is a nil pointer, exit with a panic.
148148
c.builder.SetInsertPointAtEnd(faultBlock)
149-
c.createRuntimeCall("nilpanic", nil, "")
149+
c.createRuntimeCall("nilPanic", nil, "")
150150
c.builder.CreateUnreachable()
151151

152152
// Ok: this is a valid pointer.

compiler/func-lowering.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,17 @@ func (c *Compiler) LowerFuncValues() {
154154
// What we'll do is transform the following:
155155
// rawPtr := runtime.getFuncPtr(fn)
156156
// if func.rawPtr == nil {
157-
// runtime.nilpanic()
157+
// runtime.nilPanic()
158158
// }
159159
// result := func.rawPtr(...args, func.context)
160160
// into this:
161161
// if false {
162-
// runtime.nilpanic()
162+
// runtime.nilPanic()
163163
// }
164164
// var result // Phi
165165
// switch fn.id {
166166
// case 0:
167-
// runtime.nilpanic()
167+
// runtime.nilPanic()
168168
// case 1:
169169
// result = call first implementation...
170170
// case 2:
@@ -222,7 +222,7 @@ func (c *Compiler) LowerFuncValues() {
222222
// The 0 case, which is actually a nil check.
223223
nilBlock := llvm.InsertBasicBlock(nextBlock, "func.nil")
224224
c.builder.SetInsertPointAtEnd(nilBlock)
225-
c.createRuntimeCall("nilpanic", nil, "")
225+
c.createRuntimeCall("nilPanic", nil, "")
226226
c.builder.CreateUnreachable()
227227
sw.AddCase(llvm.ConstInt(c.uintptrType, 0, false), nilBlock)
228228

src/runtime/panic.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ func isnil(ptr *uint8) bool {
3636
}
3737

3838
// Panic when trying to dereference a nil pointer.
39-
func nilpanic() {
39+
func nilPanic() {
4040
runtimePanic("nil pointer dereference")
4141
}
4242

4343
// Panic when trying to acces an array or slice out of bounds.
44-
func lookuppanic() {
44+
func lookupPanic() {
4545
runtimePanic("index out of range")
4646
}
4747

4848
// Panic when trying to slice a slice out of bounds.
49-
func slicepanic() {
49+
func slicePanic() {
5050
runtimePanic("slice out of range")
5151
}

0 commit comments

Comments
 (0)