avm2: Add ParamtersExt::get_value
This commit is contained in:
parent
df29536197
commit
74d424e82f
|
@ -9,6 +9,9 @@ use crate::string::AvmString;
|
||||||
/// It is expected that the AS signature is correct and you only operate on values defined from it.
|
/// It is expected that the AS signature is correct and you only operate on values defined from it.
|
||||||
/// These values will be `expect()`ed to exist, and any method here will panic if they're missing.
|
/// These values will be `expect()`ed to exist, and any method here will panic if they're missing.
|
||||||
pub trait ParametersExt<'gc> {
|
pub trait ParametersExt<'gc> {
|
||||||
|
/// Gets the value at the given index.
|
||||||
|
fn get_value(&self, index: usize) -> Value<'gc>;
|
||||||
|
|
||||||
/// Gets the value at the given index and coerces it to an Object.
|
/// Gets the value at the given index and coerces it to an Object.
|
||||||
///
|
///
|
||||||
/// If the value is null or is undefined, a TypeError 2007 is raised.
|
/// If the value is null or is undefined, a TypeError 2007 is raised.
|
||||||
|
@ -86,6 +89,11 @@ pub trait ParametersExt<'gc> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'gc> ParametersExt<'gc> for &[Value<'gc>] {
|
impl<'gc> ParametersExt<'gc> for &[Value<'gc>] {
|
||||||
|
#[inline]
|
||||||
|
fn get_value(&self, index: usize) -> Value<'gc> {
|
||||||
|
self[index]
|
||||||
|
}
|
||||||
|
|
||||||
fn get_object(
|
fn get_object(
|
||||||
&self,
|
&self,
|
||||||
activation: &mut Activation<'_, 'gc>,
|
activation: &mut Activation<'_, 'gc>,
|
||||||
|
|
Loading…
Reference in New Issue