-
-
Notifications
You must be signed in to change notification settings - Fork 891
avm2: Introduce ParametersExt and use it inside bitmapdata #9930
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
Conversation
Does this PR obsolete/supersede #7895? |
I'd say no. That PR is on hold until everyone can agree on the design, and I think makes a nicer end goal, but this works for today. |
Value::Null | Value::Undefined => None, | ||
Value::Object(o) => Some(o), | ||
primitive => Some( | ||
PrimitiveObject::from_primitive(primitive, activation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in most places we don't actually expect a primitive (matrix, color_transform, etc), so I'd consider making it a default? (just documenting it well).
On that note, I'd also add get_value(idx)
just for a consistent api.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added get_value which is this[index]
for now.
Good point about non-primitives, I think I'll need to consider that a bit though. Will handle it in a future PR if that's ok!
… happens in AS definition
We currently have so many different ways of pulling out parameters from the function, and almost every single one is wrong. The "correct" way to do it tends to be extremely verbose.
This introduces common methods for correctly getting the value of a given type from the function parameters slice, and converts BitmapData to use it as an initial proof of concept.
It's still missing more useful functions like getting native object types (DisplayObject from an arg, for example), but it's already a significant improvement.