Skip to content

Commit

Permalink
avm2: Use Value as receiver in all native functions instead of Object
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-McSweeney authored and torokati44 committed Dec 16, 2024
1 parent 8b9cb46 commit 226fee2
Show file tree
Hide file tree
Showing 99 changed files with 2,634 additions and 1,069 deletions.
2 changes: 1 addition & 1 deletion core/src/avm2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ impl<'gc> Avm2<'gc> {
.context
.avm2
.push_global_init(init_activation.context.gc_context, script);
let r = (method.method)(&mut init_activation, scope, &[]);
let r = (method.method)(&mut init_activation, Value::Object(scope), &[]);
init_activation
.context
.avm2
Expand Down
2 changes: 1 addition & 1 deletion core/src/avm2/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub fn exec<'gc>(
.context
.avm2
.push_call(activation.context.gc_context, method, bound_class);
(bm.method)(&mut activation, receiver, &arguments)
(bm.method)(&mut activation, Value::Object(receiver), &arguments)
}
Method::Bytecode(bm) => {
if bm.is_unchecked() {
Expand Down
11 changes: 5 additions & 6 deletions core/src/avm2/globals/__ruffle__.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use crate::avm2::activation::Activation;
use crate::avm2::error::Error;
use crate::avm2::object::Object;
use crate::avm2::value::Value;
use crate::string::WStr;
use crate::stub::Stub;
use std::borrow::Cow;

pub fn stub_method<'gc>(
activation: &mut Activation<'_, 'gc>,
_this: Object<'gc>,
_this: Value<'gc>,
args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> {
match args {
Expand Down Expand Up @@ -45,7 +44,7 @@ pub fn stub_method<'gc>(

pub fn stub_getter<'gc>(
activation: &mut Activation<'_, 'gc>,
_this: Object<'gc>,
_this: Value<'gc>,
args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> {
match args {
Expand All @@ -68,7 +67,7 @@ pub fn stub_getter<'gc>(

pub fn stub_setter<'gc>(
activation: &mut Activation<'_, 'gc>,
_this: Object<'gc>,
_this: Value<'gc>,
args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> {
match args {
Expand All @@ -91,7 +90,7 @@ pub fn stub_setter<'gc>(

pub fn stub_constructor<'gc>(
activation: &mut Activation<'_, 'gc>,
_this: Object<'gc>,
_this: Value<'gc>,
args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> {
match args {
Expand Down Expand Up @@ -124,7 +123,7 @@ pub fn stub_constructor<'gc>(

pub fn log_warn<'gc>(
activation: &mut Activation<'_, 'gc>,
_this: Object<'gc>,
_this: Value<'gc>,
args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> {
match args {
Expand Down
Loading

0 comments on commit 226fee2

Please sign in to comment.