Made panic messages in expression-multiplex.go more informative

This commit is contained in:
Sasha Koshka 2024-01-27 09:15:39 +00:00
parent 43130fd0da
commit 8bf3938842
2 changed files with 5 additions and 8 deletions

View File

@ -176,4 +176,3 @@ func (this *generator) generateBlockLoc (block *entity.Block) (llvm.Value, error
return this.generateStatementLoc(block.Steps[lastIndex]) return this.generateStatementLoc(block.Steps[lastIndex])
} }

View File

@ -24,8 +24,7 @@ func (this *generator) generateExpression (expression entity.Expression) (regist
// TODO: some of these could stand to know that they have a choice in // TODO: some of these could stand to know that they have a choice in
// the matter. // the matter.
switch expression := expression.(type) { switch expression := expression.(type) {// these give us an address
// these give us an address
case *entity.Dereference, case *entity.Dereference,
*entity.MemberAccess, *entity.MemberAccess,
*entity.Slice, *entity.Slice,
@ -45,7 +44,6 @@ func (this *generator) generateExpression (expression entity.Expression) (regist
*entity.ValueCast, *entity.ValueCast,
*entity.BitCast, *entity.BitCast,
*entity.Operation, *entity.Operation,
*entity.Block,
*entity.LiteralInt, *entity.LiteralInt,
*entity.LiteralFloat, *entity.LiteralFloat,
*entity.LiteralBoolean, *entity.LiteralBoolean,
@ -118,7 +116,7 @@ func (this *generator) generateExpressionVal (expression entity.Expression) (llv
return this.generateLiteralNil(expression) return this.generateLiteralNil(expression)
default: default:
panic(fmt.Sprintf ( panic(fmt.Sprintf (
"BUG: generator doesnt know about expression %v, ty: %T", "BUG: generator doesnt know about value expression %v, ty: %T",
expression, expression)) expression, expression))
} }
} }
@ -174,7 +172,7 @@ func (this *generator) generateExpressionLoc (expression entity.Expression) (llv
return this.generateLiteralStructLoc(expression) return this.generateLiteralStructLoc(expression)
default: default:
panic(fmt.Sprintf ( panic(fmt.Sprintf (
"BUG: generator doesnt know about expression %v, ty: %T", "BUG: generator doesnt know about location expression %v, ty: %T",
expression, expression)) expression, expression))
} }
} }
@ -200,7 +198,7 @@ func (this *generator) generateStatementVal (statement entity.Statement) (llvm.V
return this.generateExpressionVal(statement) return this.generateExpressionVal(statement)
default: default:
panic(fmt.Sprintf ( panic(fmt.Sprintf (
"BUG: generator doesnt know about statement %v, ty: %T", "BUG: generator doesnt know about value statement %v, ty: %T",
statement, statement)) statement, statement))
} }
} }
@ -211,7 +209,7 @@ func (this *generator) generateStatementLoc (statement entity.Statement) (llvm.V
return this.generateExpressionLoc(statement) return this.generateExpressionLoc(statement)
default: default:
panic(fmt.Sprintf ( panic(fmt.Sprintf (
"BUG: generator doesnt know about statement %v, ty: %T", "BUG: generator doesnt know about location statement %v, ty: %T",
statement, statement)) statement, statement))
} }
} }