Emit type and range errors

This commit is contained in:
Andrew Morris
2023-03-21 16:44:41 +11:00
parent e657604cbe
commit feeb0594de
22 changed files with 382 additions and 79 deletions

View File

@@ -3,12 +3,12 @@ use std::rc::Rc;
use num_bigint::BigInt;
use crate::format_err;
use super::stack_frame::StackFrame;
use super::vs_array::VsArray;
use super::vs_class::VsClass;
use super::vs_object::VsObject;
use super::vs_value::{LoadFunctionResult, Val, ValTrait, VsType};
use crate::stack_frame::StackFrame;
use crate::vs_array::VsArray;
use crate::vs_class::VsClass;
use crate::vs_object::VsObject;
use crate::vs_value::{LoadFunctionResult, Val, ValTrait, VsType};
use crate::{builtins::type_error_builtin::to_type_error, type_error};
pub struct NativeFrameFunction {
pub make_frame: fn() -> StackFrame,
@@ -66,7 +66,7 @@ impl ValTrait for NativeFrameFunction {
}
fn submov(&mut self, _key: Val, _value: Val) -> Result<(), Val> {
format_err!("TypeError: Cannot assign to subscript of native function")
type_error!("Cannot assign to subscript of native function")
}
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {