avm2: Add a `make_error_1014` function and use it
This commit is contained in:
parent
f76117a2be
commit
788c3da4aa
|
@ -204,6 +204,24 @@ pub fn make_error_1010<'gc>(
|
|||
}
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[cold]
|
||||
pub fn make_error_1014<'gc>(
|
||||
activation: &mut Activation<'_, 'gc>,
|
||||
class_name: AvmString<'gc>,
|
||||
) -> Error<'gc> {
|
||||
let err = verify_error(
|
||||
activation,
|
||||
&format!("Error #1014: Class {} could not be found.", class_name),
|
||||
1014,
|
||||
);
|
||||
|
||||
match err {
|
||||
Ok(err) => Error::AvmError(err),
|
||||
Err(err) => err,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[cold]
|
||||
pub fn make_error_1021<'gc>(activation: &mut Activation<'_, 'gc>) -> Error<'gc> {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::avm2::class::Class;
|
||||
use crate::avm2::error::{
|
||||
make_error_1021, make_error_1025, make_error_1032, make_error_1054, make_error_1107,
|
||||
verify_error,
|
||||
make_error_1014, make_error_1021, make_error_1025, make_error_1032, make_error_1054,
|
||||
make_error_1107, verify_error,
|
||||
};
|
||||
use crate::avm2::method::BytecodeMethod;
|
||||
use crate::avm2::multiname::Multiname;
|
||||
|
@ -299,27 +299,16 @@ pub fn verify_method<'gc>(
|
|||
|
||||
if multiname.has_lazy_component() {
|
||||
// This matches FP's error message
|
||||
return Err(Error::AvmError(verify_error(
|
||||
activation,
|
||||
"Error #1014: Class [] could not be found.",
|
||||
1014,
|
||||
)?));
|
||||
return Err(make_error_1014(activation, "[]".into()));
|
||||
}
|
||||
|
||||
activation
|
||||
.domain()
|
||||
.get_class(&multiname, activation.context.gc_context)
|
||||
.ok_or_else(|| {
|
||||
Error::AvmError(
|
||||
verify_error(
|
||||
activation,
|
||||
&format!(
|
||||
"Error #1014: Class {} could not be found.",
|
||||
multiname.to_qualified_name(activation.context.gc_context)
|
||||
),
|
||||
1014,
|
||||
)
|
||||
.expect("Error should construct"),
|
||||
make_error_1014(
|
||||
activation,
|
||||
multiname.to_qualified_name(activation.context.gc_context),
|
||||
)
|
||||
})?;
|
||||
}
|
||||
|
@ -419,27 +408,16 @@ pub fn verify_method<'gc>(
|
|||
|
||||
if pooled_type_name.has_lazy_component() {
|
||||
// This matches FP's error message
|
||||
return Err(Error::AvmError(verify_error(
|
||||
activation,
|
||||
"Error #1014: Class [] could not be found.",
|
||||
1014,
|
||||
)?));
|
||||
return Err(make_error_1014(activation, "[]".into()));
|
||||
}
|
||||
|
||||
let resolved_type = activation
|
||||
.domain()
|
||||
.get_class(&pooled_type_name, activation.context.gc_context)
|
||||
.ok_or_else(|| {
|
||||
Error::AvmError(
|
||||
verify_error(
|
||||
activation,
|
||||
&format!(
|
||||
"Error #1014: Class {} could not be found.",
|
||||
pooled_type_name.to_qualified_name(activation.context.gc_context)
|
||||
),
|
||||
1014,
|
||||
)
|
||||
.expect("Error should construct"),
|
||||
make_error_1014(
|
||||
activation,
|
||||
pooled_type_name.to_qualified_name(activation.context.gc_context),
|
||||
)
|
||||
})?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue