[fine] Many test improvements, error improvements

- Check for more error conditions
- Move to more definitive error assertions
- Simpler error messages in some cases
- Test more conditions more thoroughly, revisit old tests
This commit is contained in:
John Doty 2024-01-21 08:14:42 -08:00
parent d0b74db715
commit 5f0a0b3268
20 changed files with 186 additions and 118 deletions

View file

@ -308,7 +308,6 @@ fn compile_literal(c: &mut Compiler, t: TreeRef, tr: &Tree) -> CR {
Instruction::PushFalse
}),
Type::String => {
// TODO: Interpret string here make good!
let mut result = String::new();
let mut input = tok.as_str().chars();
while let Some(ch) = input.next() {
@ -514,7 +513,6 @@ fn compile_identifier_expression(c: &mut Compiler, t: TreeRef, tree: &Tree) -> O
}
fn compile_load_declaration(c: &mut Compiler, t: TreeRef, declaration: &Declaration) -> CR {
// TODO: Load function declaration. :P
let instruction = match declaration {
Declaration::Variable {
location, index, ..
@ -555,6 +553,8 @@ fn compile_load_declaration(c: &mut Compiler, t: TreeRef, declaration: &Declarat
Instruction::LoadFunction(index)
}
Declaration::ExternFunction { id, .. } => Instruction::LoadExternFunction(id.id()),
// There is no universe where it's possible to use a class as a variable.
Declaration::Class { .. } => Instruction::Panic,
};