From 74d424e82fbf61ca6e753da9d439a3d9fbaa5ae4 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Tue, 14 Mar 2023 07:17:40 +0100 Subject: [PATCH] avm2: Add ParamtersExt::get_value --- core/src/avm2/parameters.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/avm2/parameters.rs b/core/src/avm2/parameters.rs index 9a2443f39..1766688ca 100644 --- a/core/src/avm2/parameters.rs +++ b/core/src/avm2/parameters.rs @@ -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. /// These values will be `expect()`ed to exist, and any method here will panic if they're missing. 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. /// /// 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>] { + #[inline] + fn get_value(&self, index: usize) -> Value<'gc> { + self[index] + } + fn get_object( &self, activation: &mut Activation<'_, 'gc>,