Commit Graph

2227 Commits

Author SHA1 Message Date
David Wendt 5c0e095ab5 `getlex` does not support runtime multinames according to spec. 2020-07-13 17:43:44 -04:00
David Wendt 9e120c216b Propagate arguments into local registers when calling AVM functions. 2020-07-13 17:43:44 -04:00
David Wendt 5b00c1fd96 Ensure that `this` is properly populated into local registers. 2020-07-13 17:43:44 -04:00
David Wendt b2f5307213 Add `flash.display.Sprite` because Flash Builder tests demand it. 2020-07-13 17:43:42 -04:00
David Wendt 4ab9a46515 Impl `getscopeobject` 2020-07-13 17:43:41 -04:00
David Wendt 5f98a198cb Remove dead code in Activation 2020-07-13 17:43:41 -04:00
David Wendt 279d90ec22 Remove `define_value` from AVM2 objects.
We already have a menagerie of `install_*` functions for adding static properties to a an object; and we don't have to support any kind of asinine nonsense liks `ASSetPropFlags` here. Ergo, we don't need this.
2020-07-13 17:43:39 -04:00
David Wendt cbce8660bc Implement `deleteproperty`. 2020-07-13 17:43:37 -04:00
David Wendt d19d9ef90e Clean up unused variables 2020-07-13 17:43:35 -04:00
David Wendt 8b56973d29 Remove scope methods that aren't necessary.
In AVM1, these are necessary because `ActionGetVariable` et. all directly interface with the scope chain. In AVM2, you `findpropstrict` up the scope chain, which gives you a normal object that you can interact with as you like. Ergo, the scope chain doesn't need set/get property methods.
2020-07-13 17:43:34 -04:00
David Wendt fd275bdcf3 Implement constant slots and traits.
Class and Function traits now generate const slots, too.
2020-07-13 17:43:33 -04:00
David Wendt 412c3d8489 Implement `Function` traits. 2020-07-13 17:43:29 -04:00
David Wendt af70024f62 Implement slot traits. 2020-07-13 17:43:28 -04:00
David Wendt 200c10b4a2 Classes can fit in slots, so let's stick them in there. 2020-07-13 17:43:27 -04:00
David Wendt d42b16f021 Add stub impl of `flash.display.MovieClip`. 2020-07-13 17:43:27 -04:00
David Wendt ebcfee4676 Add specific error messages for unresolvable super classes 2020-07-13 17:43:27 -04:00
David Wendt 362294181f Implement constant pool default values (index 0).
All constant pools in an ABC file are actually numbered starting from one; there's an implicit 0 entry not stored in the file that the runtime is expected to retrieve when pulling constants from the pool.

The AVM2/ABC spec only mentions this in passing.
2020-07-13 17:43:27 -04:00
David Wendt e1916519dd Add debug for trait installs 2020-07-13 17:43:26 -04:00
David Wendt cfe0e333be Fix invalid script index when loading an ABC file. 2020-07-13 17:43:26 -04:00
David Wendt bc0bdf8496 The public namespace appears to just be an unnamed package namespace, not a regular namespace. 2020-07-13 17:43:25 -04:00
David Wendt 04879fc419 Implement class traits.
This allows the AVM to declare classes, which necessitated some refactoring to avoid double-borrows or having to do something "magic" that would dodge virtual properties.
2020-07-13 17:43:25 -04:00
David Wendt ecfd5abb41 Impl `construct` and `constructprop`. 2020-07-13 17:43:24 -04:00
David Wendt 1ab4091050 Implement slots and related opcodes. 2020-07-13 17:43:24 -04:00
David Wendt 88957b2b3d Add stub builtins for Object and Function. These are more-or-less identical to the way we did it in AVM1 (e.g. no fancy player globals file) 2020-07-13 17:43:24 -04:00
David Wendt 1945f36dc0 When running the initial script, also install it's traits onto the global scope. 2020-07-13 17:43:23 -04:00
David Wendt 35c36a807b Always execute the last script when loading an ABC file 2020-07-13 17:43:23 -04:00
David Wendt 560900e708 ABC files are always pre-loaded.
Frame actions are handled as syntactic sugar on top of a `MovieClip` subclass and event handlers. ABC scripts do not live on the normal timeline.
2020-07-13 17:43:23 -04:00
David Wendt 502936f0fe Implement non-slot trait properties (Method, Getter, and Setter) 2020-07-13 17:43:22 -04:00
David Wendt 12e9fbbffb Impl virtual property slots 2020-07-13 17:43:22 -04:00
David Wendt eb0c9dcaec Allow constructing a function around a particular class definition.
I'm writing all this code assuming that classes and traits are syntactic sugar around ES3-style prototype chains on function objects. Hence, `FunctionObject` is still our workhorse object type for implementing typing.
2020-07-13 17:43:21 -04:00
David Wendt cf490bedfb Unstub `proto`. 2020-07-13 17:43:20 -04:00
David Wendt b12c6e0ff1 Implement closure scope stacks. 2020-07-13 17:43:20 -04:00
David Wendt 7d75255a1a Add global scope which is automatically included on all new activations. 2020-07-13 17:43:20 -04:00
David Wendt 984e701142 Swap out `has_property`'s stub impl. 2020-07-13 17:43:19 -04:00
David Wendt e5142e85e9 Replace `get_property` and `set_property` with slightly-less-stub impls. 2020-07-13 17:43:17 -04:00
David Wendt d56db06447 Implement `resolve_multiname`, sort of. 2020-07-13 17:43:16 -04:00
David Wendt 78a1c9a7e3 Implement `pushscope`, `popscope`, and `pushwith`. 2020-07-13 17:43:16 -04:00
David Wendt 5e6fc79f42 Implement `getproperty`, `setproperty` 2020-07-13 17:43:15 -04:00
David Wendt 60c16b0a60 Implement `findproperty`, `findpropstrict`, and `getlex`; which are necessary for interacting with global scope. 2020-07-13 17:43:15 -04:00
David Wendt 3c8035f871 clippy pls 2020-07-13 17:43:14 -04:00
David Wendt 12223d524a Add support methods in `Scope` to support opcodes that traverse the scope chain. 2020-07-13 17:43:14 -04:00
David Wendt 0ff1ba7120 Multiname resolution is another object method. 2020-07-13 17:43:14 -04:00
David Wendt 376d1a8ca6 Add scope support 2020-07-13 17:43:13 -04:00
David Wendt 3b476cba9e Implement `pushnamespace` since that's a value type now 2020-07-13 17:43:13 -04:00
David Wendt 1a6acb9440 Implement late binding and runtime qualifications for names. 2020-07-13 17:43:12 -04:00
David Wendt 2f3a3aff6f Add exact type assertion methods for strings and namespace values. 2020-07-13 17:43:11 -04:00
David Wendt 6d8dc6e63d Pull ABC constant pool methods out of Avm2 and into Value.
The old methods still exist and do the same thing, but the Value methods
accept arbitrary AbcFile references.
2020-07-13 17:42:51 -04:00
David Wendt c65d93d063 Implement multinames, sans runtime namespace support. 2020-07-13 17:42:50 -04:00
David Wendt 6bd94d6bc9 `from_abc_namespace` should accept a namespace index and retrieve it from the file's constant pool itself. 2020-07-13 17:42:50 -04:00
David Wendt 43f1080fab Implement namespaces as a value type 2020-07-13 17:42:49 -04:00