1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-10-21 02:24:34 +00:00

Added example of cast error giving an exception. #260

This commit is contained in:
jespergravgaard 2019-08-11 23:59:29 +02:00
parent c10d646a5d
commit 88cc028285
3 changed files with 12 additions and 1 deletions

View File

@ -115,7 +115,6 @@ switchCase:
'case' expr ':' stmtSeq?
;
forLoop
: forClassicInit ';' commaExpr ';' commaExpr? #forClassic
| declTypes? NAME ':' expr ( '..' ) expr #forRange

View File

@ -4,6 +4,7 @@ import dk.camelot64.kickc.Compiler;
import dk.camelot64.kickc.NumberParser;
import dk.camelot64.kickc.asm.AsmClobber;
import dk.camelot64.kickc.model.*;
import dk.camelot64.kickc.model.InternalError;
import dk.camelot64.kickc.model.operators.*;
import dk.camelot64.kickc.model.statements.*;
import dk.camelot64.kickc.model.symbols.*;
@ -972,6 +973,11 @@ public class Pass0GenerateStatementSequence extends KickCBaseVisitor<Object> {
return null;
}
@Override
public Object visitStmtSwitch(KickCParser.StmtSwitchContext ctx) {
throw new InternalError("switch() is not supported in this version of the compiler.");
}
@Override
public Object visitStmtFor(KickCParser.StmtForContext ctx) {
this.visit(ctx.forLoop());

View File

@ -0,0 +1,6 @@
// Results in exception instead of a nice error message
// Reported by Paul Gardner-Stephen
void main() {
*$d020 = $01;
}