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)]
|
#[inline(never)]
|
||||||
#[cold]
|
#[cold]
|
||||||
pub fn make_error_1021<'gc>(activation: &mut Activation<'_, 'gc>) -> Error<'gc> {
|
pub fn make_error_1021<'gc>(activation: &mut Activation<'_, 'gc>) -> Error<'gc> {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::avm2::class::Class;
|
use crate::avm2::class::Class;
|
||||||
use crate::avm2::error::{
|
use crate::avm2::error::{
|
||||||
make_error_1021, make_error_1025, make_error_1032, make_error_1054, make_error_1107,
|
make_error_1014, make_error_1021, make_error_1025, make_error_1032, make_error_1054,
|
||||||
verify_error,
|
make_error_1107, verify_error,
|
||||||
};
|
};
|
||||||
use crate::avm2::method::BytecodeMethod;
|
use crate::avm2::method::BytecodeMethod;
|
||||||
use crate::avm2::multiname::Multiname;
|
use crate::avm2::multiname::Multiname;
|
||||||
|
@ -299,27 +299,16 @@ pub fn verify_method<'gc>(
|
||||||
|
|
||||||
if multiname.has_lazy_component() {
|
if multiname.has_lazy_component() {
|
||||||
// This matches FP's error message
|
// This matches FP's error message
|
||||||
return Err(Error::AvmError(verify_error(
|
return Err(make_error_1014(activation, "[]".into()));
|
||||||
activation,
|
|
||||||
"Error #1014: Class [] could not be found.",
|
|
||||||
1014,
|
|
||||||
)?));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
activation
|
activation
|
||||||
.domain()
|
.domain()
|
||||||
.get_class(&multiname, activation.context.gc_context)
|
.get_class(&multiname, activation.context.gc_context)
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
Error::AvmError(
|
make_error_1014(
|
||||||
verify_error(
|
activation,
|
||||||
activation,
|
multiname.to_qualified_name(activation.context.gc_context),
|
||||||
&format!(
|
|
||||||
"Error #1014: Class {} could not be found.",
|
|
||||||
multiname.to_qualified_name(activation.context.gc_context)
|
|
||||||
),
|
|
||||||
1014,
|
|
||||||
)
|
|
||||||
.expect("Error should construct"),
|
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
@ -419,27 +408,16 @@ pub fn verify_method<'gc>(
|
||||||
|
|
||||||
if pooled_type_name.has_lazy_component() {
|
if pooled_type_name.has_lazy_component() {
|
||||||
// This matches FP's error message
|
// This matches FP's error message
|
||||||
return Err(Error::AvmError(verify_error(
|
return Err(make_error_1014(activation, "[]".into()));
|
||||||
activation,
|
|
||||||
"Error #1014: Class [] could not be found.",
|
|
||||||
1014,
|
|
||||||
)?));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let resolved_type = activation
|
let resolved_type = activation
|
||||||
.domain()
|
.domain()
|
||||||
.get_class(&pooled_type_name, activation.context.gc_context)
|
.get_class(&pooled_type_name, activation.context.gc_context)
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
Error::AvmError(
|
make_error_1014(
|
||||||
verify_error(
|
activation,
|
||||||
activation,
|
pooled_type_name.to_qualified_name(activation.context.gc_context),
|
||||||
&format!(
|
|
||||||
"Error #1014: Class {} could not be found.",
|
|
||||||
pooled_type_name.to_qualified_name(activation.context.gc_context)
|
|
||||||
),
|
|
||||||
1014,
|
|
||||||
)
|
|
||||||
.expect("Error should construct"),
|
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue