Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avm2: Implement Op::TypeOf #3176

Merged
merged 1 commit into from
Feb 17, 2021
Merged

avm2: Implement Op::TypeOf #3176

merged 1 commit into from
Feb 17, 2021

Conversation

CUB3D
Copy link
Contributor

@CUB3D CUB3D commented Feb 10, 2021

This implements the TypeOf instruction for AVM2, to be able to fully test this I also needed to create a minimal stub for both XML and XMLList as these have a different result ("xml") compared to other objects ("object").

Copy link

@seanpm2001 seanpm2001 left a comment

Choose a reason for hiding this comment

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

It looks good. However, on core/src/avm2/activation.rs on line 2288, there appears to be a unclosed parentheses. Is this type safe in Rust, or should this be fixed? Other than that, it looks pretty good.

@torokati44
Copy link
Member

The automatic tests passed, so there can't really be any syntactical errors in the code.
It might look confusing at first, but in Rust, putting the condition in () is not necessary - discouraged, even -, while the {} around each arm is mandatory. Almost opposite of how it is in C.
And I'm not exactly sure how this would relate to type safety anyways.

@seanpm2001
Copy link

Thank you for the reply. This helps clarify it for me. I was originally wondering how it passed the test with the syntax. Now I know why. I am just so used to the strict syntax in Python when it comes to whitespace and parentheses and most other programming languages requiring a paranthese to always have a closing paranthese. example:

foo = str(input("Sample")) # Correct
bar = str(input("Sample") # Incorrect

Also, I used the word type safety, as I mistook it for a type of syntax error. I will try to get a better definition of type safety and just say "possible syntax error" from now on.

@Herschel
Copy link
Member

I don't believe you should use the prototypes to check for XML/XMLList, here's a test:
XMLproto.zip
Outputs "xml" twice in Ruffle, "object" and then "xml" in Flash Player.

@Herschel
Copy link
Member

Thank you!

@Herschel Herschel merged commit b93e556 into ruffle-rs:master Feb 17, 2021
@CUB3D CUB3D deleted the as3_typeof branch April 21, 2021 23:50
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.

None yet

4 participants