Skip to content

Commit 363ce43

Browse files
committed
compile: Fixup panics to have name of thing they are panicing about
1 parent 0a8e720 commit 363ce43

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

compile/compile.go

+42-42
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (c *compiler) compileStmt(stmt ast.Stmt) {
212212
// Body []Stmt
213213
// DecoratorList []Expr
214214
// Returns Expr
215-
panic("FIXME not implemented")
215+
panic("FIXME compile: FunctionDef not implemented")
216216
_ = node
217217
case *ast.ClassDef:
218218
// Name Identifier
@@ -222,79 +222,79 @@ func (c *compiler) compileStmt(stmt ast.Stmt) {
222222
// Kwargs Expr
223223
// Body []Stmt
224224
// DecoratorList []Expr
225-
panic("FIXME not implemented")
225+
panic("FIXME compile: ClassDef not implemented")
226226
case *ast.Return:
227227
// Value Expr
228-
panic("FIXME not implemented")
228+
panic("FIXME compile: Return not implemented")
229229
case *ast.Delete:
230230
// Targets []Expr
231-
panic("FIXME not implemented")
231+
panic("FIXME compile: Delete not implemented")
232232
case *ast.Assign:
233233
// Targets []Expr
234234
// Value Expr
235-
panic("FIXME not implemented")
235+
panic("FIXME compile: Assign not implemented")
236236
case *ast.AugAssign:
237237
// Target Expr
238238
// Op OperatorNumber
239239
// Value Expr
240-
panic("FIXME not implemented")
240+
panic("FIXME compile: AugAssign not implemented")
241241
case *ast.For:
242242
// Target Expr
243243
// Iter Expr
244244
// Body []Stmt
245245
// Orelse []Stmt
246-
panic("FIXME not implemented")
246+
panic("FIXME compile: For not implemented")
247247
case *ast.While:
248248
// Test Expr
249249
// Body []Stmt
250250
// Orelse []Stmt
251-
panic("FIXME not implemented")
251+
panic("FIXME compile: While not implemented")
252252
case *ast.If:
253253
// Test Expr
254254
// Body []Stmt
255255
// Orelse []Stmt
256-
panic("FIXME not implemented")
256+
panic("FIXME compile: If not implemented")
257257
case *ast.With:
258258
// Items []*WithItem
259259
// Body []Stmt
260-
panic("FIXME not implemented")
260+
panic("FIXME compile: With not implemented")
261261
case *ast.Raise:
262262
// Exc Expr
263263
// Cause Expr
264-
panic("FIXME not implemented")
264+
panic("FIXME compile: Raise not implemented")
265265
case *ast.Try:
266266
// Body []Stmt
267267
// Handlers []*ExceptHandler
268268
// Orelse []Stmt
269269
// Finalbody []Stmt
270-
panic("FIXME not implemented")
270+
panic("FIXME compile: Try not implemented")
271271
case *ast.Assert:
272272
// Test Expr
273273
// Msg Expr
274-
panic("FIXME not implemented")
274+
panic("FIXME compile: Assert not implemented")
275275
case *ast.Import:
276276
// Names []*Alias
277-
panic("FIXME not implemented")
277+
panic("FIXME compile: Import not implemented")
278278
case *ast.ImportFrom:
279279
// Module Identifier
280280
// Names []*Alias
281281
// Level int
282-
panic("FIXME not implemented")
282+
panic("FIXME compile: ImportFrom not implemented")
283283
case *ast.Global:
284284
// Names []Identifier
285-
panic("FIXME not implemented")
285+
panic("FIXME compile: Global not implemented")
286286
case *ast.Nonlocal:
287287
// Names []Identifier
288-
panic("FIXME not implemented")
288+
panic("FIXME compile: Nonlocal not implemented")
289289
case *ast.ExprStmt:
290290
// Value Expr
291-
panic("FIXME not implemented")
291+
panic("FIXME compile: ExprStmt not implemented")
292292
case *ast.Pass:
293293
// No nothing
294294
case *ast.Break:
295-
panic("FIXME not implemented")
295+
panic("FIXME compile: Break not implemented")
296296
case *ast.Continue:
297-
panic("FIXME not implemented")
297+
panic("FIXME compile: Continue not implemented")
298298
default:
299299
panic(py.ExceptionNewf(py.SyntaxError, "Unknown StmtBase: %v", stmt))
300300
}
@@ -380,7 +380,7 @@ func (c *compiler) compileExpr(expr ast.Expr) {
380380
case *ast.Lambda:
381381
// Args *Arguments
382382
// Body Expr
383-
panic("FIXME not implemented")
383+
panic("FIXME compile: Lambda not implemented")
384384
case *ast.IfExp:
385385
// Test Expr
386386
// Body Expr
@@ -397,45 +397,45 @@ func (c *compiler) compileExpr(expr ast.Expr) {
397397
case *ast.Dict:
398398
// Keys []Expr
399399
// Values []Expr
400-
panic("FIXME not implemented")
400+
panic("FIXME compile: Dict not implemented")
401401
case *ast.Set:
402402
// Elts []Expr
403-
panic("FIXME not implemented")
403+
panic("FIXME compile: Set not implemented")
404404
case *ast.ListComp:
405405
// Elt Expr
406406
// Generators []Comprehension
407-
panic("FIXME not implemented")
407+
panic("FIXME compile: ListComp not implemented")
408408
case *ast.SetComp:
409409
// Elt Expr
410410
// Generators []Comprehension
411-
panic("FIXME not implemented")
411+
panic("FIXME compile: SetComp not implemented")
412412
case *ast.DictComp:
413413
// Key Expr
414414
// Value Expr
415415
// Generators []Comprehension
416-
panic("FIXME not implemented")
416+
panic("FIXME compile: DictComp not implemented")
417417
case *ast.GeneratorExp:
418418
// Elt Expr
419419
// Generators []Comprehension
420-
panic("FIXME not implemented")
420+
panic("FIXME compile: GeneratorExp not implemented")
421421
case *ast.Yield:
422422
// Value Expr
423-
panic("FIXME not implemented")
423+
panic("FIXME compile: Yield not implemented")
424424
case *ast.YieldFrom:
425425
// Value Expr
426-
panic("FIXME not implemented")
426+
panic("FIXME compile: YieldFrom not implemented")
427427
case *ast.Compare:
428428
// Left Expr
429429
// Ops []CmpOp
430430
// Comparators []Expr
431-
panic("FIXME not implemented")
431+
panic("FIXME compile: Compare not implemented")
432432
case *ast.Call:
433433
// Func Expr
434434
// Args []Expr
435435
// Keywords []*Keyword
436436
// Starargs Expr
437437
// Kwargs Expr
438-
panic("FIXME not implemented")
438+
panic("FIXME compile: Call not implemented")
439439
case *ast.Num:
440440
// N Object
441441
c.OpArg(vm.LOAD_CONST, c.Const(node.N))
@@ -444,26 +444,26 @@ func (c *compiler) compileExpr(expr ast.Expr) {
444444
c.OpArg(vm.LOAD_CONST, c.Const(node.S))
445445
case *ast.Bytes:
446446
// S py.Bytes
447-
panic("FIXME not implemented")
447+
panic("FIXME compile: Bytes not implemented")
448448
case *ast.NameConstant:
449449
// Value Singleton
450-
panic("FIXME not implemented")
450+
panic("FIXME compile: NameConstant not implemented")
451451
case *ast.Ellipsis:
452-
panic("FIXME not implemented")
452+
panic("FIXME compile: Ellipsis not implemented")
453453
case *ast.Attribute:
454454
// Value Expr
455455
// Attr Identifier
456456
// Ctx ExprContext
457-
panic("FIXME not implemented")
457+
panic("FIXME compile: Attribute not implemented")
458458
case *ast.Subscript:
459459
// Value Expr
460460
// Slice Slicer
461461
// Ctx ExprContext
462-
panic("FIXME not implemented")
462+
panic("FIXME compile: Subscript not implemented")
463463
case *ast.Starred:
464464
// Value Expr
465465
// Ctx ExprContext
466-
panic("FIXME not implemented")
466+
panic("FIXME compile: Starred not implemented")
467467
case *ast.Name:
468468
// Id Identifier
469469
// Ctx ExprContext
@@ -472,11 +472,11 @@ func (c *compiler) compileExpr(expr ast.Expr) {
472472
case *ast.List:
473473
// Elts []Expr
474474
// Ctx ExprContext
475-
panic("FIXME not implemented")
475+
panic("FIXME compile: List not implemented")
476476
case *ast.Tuple:
477477
// Elts []Expr
478478
// Ctx ExprContext
479-
panic("FIXME not implemented")
479+
panic("FIXME compile: Tuple not implemented")
480480
default:
481481
panic(py.ExceptionNewf(py.SyntaxError, "Unknown ExprBase: %v", expr))
482482
}
@@ -889,13 +889,13 @@ func (o *JumpRel) Resolve() {
889889
currentSize := o.Size()
890890
currentPos := o.Pos() + currentSize
891891
if o.Dest.Pos() < currentPos {
892-
panic("Attempt use JUMP_FORWARD to jump backwards")
892+
panic("JUMP_FORWARD can't jump backwards")
893893
}
894894
o.OpArg.Arg = o.Dest.Pos() - currentPos
895895
if o.Size() != currentSize {
896-
// There is an awkward moment where jump forwards is
896+
// FIXME There is an awkward moment where jump forwards is
897897
// between 0x1000 and 0x1002 where the Arg oscillates
898898
// between 2 and 4 bytes
899-
panic("FIXME JUMP_FOWARDS size changed")
899+
panic("FIXME compile: JUMP_FOWARDS size changed")
900900
}
901901
}

0 commit comments

Comments
 (0)