Skip to content

Conversation

@kmeisthax
Copy link
Member

Our AVM2 implementation currently contains a failsafe for class coercion intended to support writing self-referencing static properties (singletons) in class initializers. However, it does not account for AVM2 properties being nullable, and will spuriously error with Attempted to perform (private) resolution of nonexistent type (type) when coercing null or undefined.

This adds a check for those two values and a test to verify them. As far as I'm aware, we will not need similar failsafes for other primitive values as our AS3 implementations of such do not have self-referencing static properties.

The code pattern this is intended to support is:

class Foo {
    private static var INSTANCE: Foo = null;
}

@kmeisthax kmeisthax force-pushed the avm2-classsingleton branch from 328a0ee to c0c8b87 Compare August 28, 2022 19:39
Copy link
Collaborator

@adrian17 adrian17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This layer of hacks keeps getting bigger ;D

@kmeisthax kmeisthax merged commit 4de4656 into ruffle-rs:master Aug 28, 2022
@ghost ghost mentioned this pull request Aug 29, 2022
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants