This commit is contained in:
gingerBill
2023-06-07 13:08:15 +01:00
parent 9941ec85d8
commit 349641e95f
2 changed files with 5 additions and 4 deletions
-3
View File
@@ -342,9 +342,6 @@ gb_internal ExactValue exact_value_from_basic_literal(TokenKind kind, String con
utf8_decode(string.text, string.len, &r); utf8_decode(string.text, string.len, &r);
return exact_value_i64(r); return exact_value_i64(r);
} }
default:
GB_PANIC("Invalid token for basic literal");
break;
} }
ExactValue result = {ExactValue_Invalid}; ExactValue result = {ExactValue_Invalid};
+5 -1
View File
@@ -666,7 +666,11 @@ gb_internal ExactValue exact_value_from_token(AstFile *f, Token const &token) {
} }
break; break;
} }
return exact_value_from_basic_literal(token.kind, s); ExactValue value = exact_value_from_basic_literal(token.kind, s);
if (value.kind == ExactValue_Invalid) {
syntax_error(token, "Invalid token literal");
}
return value;
} }
gb_internal String string_value_from_token(AstFile *f, Token const &token) { gb_internal String string_value_from_token(AstFile *f, Token const &token) {