Commit Graph

5784 Commits

Author SHA1 Message Date
EmperorBale 32eb9d1579 avm2: Implement Dates instance initializer 2021-09-23 00:01:50 +02:00
EmperorBale db550b035c avm2: Add Date stub 2021-09-23 00:01:50 +02:00
relrelb 3463e50a72 avm1: Avoid `impl Into<Value<'gc>>` parameter in `Avm1::push`
This might create templatized functions leading to unnecessary code bloat.

So instead use just `Value<'gc>` parameters and add `.into()` in callers
where needed.
2021-09-22 23:13:13 +02:00
kmeisthax 42275f43f3 avm2: Properly make all classes an instance of `Class`. (#57)
* avm2: Properly make all classes an instance of `Class`.

Also, does this technically mean that `Class` is a metaclass?

* avm2: Remove `Function::from_method_and_proto` as it will no longer be needed

* avm2: Ensure builtin classes are also instances of `Class`.

This requires tying a veritable gordian knot of classes; everything needs to be allocated up-front, linked together, and then properly initialized later on. This necessitated splitting the whole class construction process up into three steps:

1. Allocation via `from_class_partial`, which does everything that can be done without any other classes
2. Weaving via `link_prototype` and `link_type`, which links all of the allocated parts together correctly. This also includes initializing `SystemClasses` and `SystemPrototypes`.
3. Initialization via `into_finished_class`, which must be done *after* the weave has finished.

Once complete you have core classes that are all instances of `Class`, along with prototypes that have their usual legacy quirks.

Note that this does *not* make prototypes instances of their class. We do need to do that, but doing so breaks ES3 legacy support. This is because we currently only work with bound methods, but need to be able to call unbound methods in `callproperty`.

* tests: Add a test for all core classes' instance-of relationships
2021-09-22 00:29:37 +02:00
Adrian Wielgosik f8c32d3a68 avm2: Fix get_own_class_definition users to use either instance_of or as_. 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 71e41e2c92 chore: cargo fmt 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 22482ed080 avm2: Remove unwrap in get_own_class_definition 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 7736818069 avm2: Rename as_class -> get_own_class_definition 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 26e60fa8ea avm2: Rename as_class_object_really -> as_class_object 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 008162c514 avm2: Replace all uses of as_class_object by instance_of 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 4b7f8b3dbd avm2: inner_class_definition is not an Option 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 3e1764aa1e avm2: Reimplement as_class_object() in terms of other methods 2021-09-22 00:29:37 +02:00
Adrian Wielgosik e02feb919a avm2: Reimplement as_class() in terms of other methods 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 4380978b2a avm2: Move instance_allocator() to ClassObject 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 1d22009c6b avm2: Drop seemingly-unused set_class_object() 2021-09-22 00:29:37 +02:00
Adrian Wielgosik f3ab6c9da3 avm2: Move as_class_params() to ClassObject 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 0679fd1a9e amv2: Move superclass_object() to ClassObject 2021-09-22 00:29:37 +02:00
Adrian Wielgosik 2dfa875712 avm2: Move interfaces to ClassObject 2021-09-22 00:29:37 +02:00
Chris Midgley 7f09e751a1
dev: have required builds 'run' (#5332)
* dev: have required builds 'run'

* dev: remove unnecessary fields

* dev: do less in the no-op step
2021-09-21 21:01:51 +02:00
Chris Midgley 898d8df9a8 fix: firefox_unsigned, not firefox-unsigned 2021-09-21 20:57:40 +02:00
Chris Midgley dd58bbf17b fix: correct working directory for firefox signing 2021-09-21 20:10:20 +02:00
Chris Midgley 5ee34ef1ed chore: remove extraneous brackets in if 2021-09-21 20:10:20 +02:00
Chris Midgley 29111db9f3 dev: correct names of steps 2021-09-21 20:10:20 +02:00
Chris Midgley f276712c2c dev: allow for failure of firefox signing in build nightly 2021-09-21 20:10:20 +02:00
dependabot[bot] e03e8ee4f3 build(deps): bump dirs from 3.0.2 to 4.0.0
Bumps [dirs](https://github.com/soc/dirs-rs) from 3.0.2 to 4.0.0.
- [Release notes](https://github.com/soc/dirs-rs/releases)
- [Commits](https://github.com/soc/dirs-rs/commits)

---
updated-dependencies:
- dependency-name: dirs
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-21 00:07:52 +03:00
dependabot[bot] f1656f4f9c build(deps): bump pretty_assertions from 0.6.1 to 0.7.2
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 0.6.1 to 0.7.2.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.6.1...v0.7.2)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-21 00:07:31 +03:00
relrelb 6dcb2ecc1e chore: Update Cargo.lock
Forgotten in #5326.
2021-09-20 19:23:50 +03:00
relrelb dd42b563ff web: Bump wasm-bindgen to 0.2.78
As usual, also bump its helper crates (`js-sys`, `wasm-bindgen-futures`)
to the latest versions, except for `web-sys` which is locked by wgpu
to 0.3.50.
2021-09-18 21:35:50 +02:00
Chris Midgley bcf1899291 dev: use rabcdasm to produce asasm / abc output, note how 2021-09-18 18:42:36 +02:00
Chris Midgley 6f0b026f13 chore: cargo fmt 2021-09-18 18:42:36 +02:00
Chris Midgley 7bab1de1e7 avm2: implement coerce_x opcodes 2021-09-18 18:42:36 +02:00
Adrian Wielgosik ba35611c47 chore: cargo fmt 2021-09-18 18:37:46 +02:00
lukaszN a76f2403ac avm2: String rename PUBLIC_CLASS_METHODS to AS3_CLASS_METHODS 2021-09-18 18:37:46 +02:00
lukaszN 0f41193c3b avm2: String.match match lastIndex behavior 2021-09-18 18:37:46 +02:00
lukaszN d5588f3f90 avm2: String refactor index_of, match 2021-09-18 18:37:46 +02:00
lukaszN 42300d4a1e avm2: String tests 2021-09-18 18:37:46 +02:00
lukaszN 4abde1500b avm2: String fixes for tests 2021-09-18 18:37:46 +02:00
lukaszN e24390ff58 avm2: String slice, substr, substring 2021-09-18 18:37:46 +02:00
lukaszN d953fea5df avm2: String match 2021-09-18 18:37:46 +02:00
lukaszN 91d63e4dc1 avm2: class methods can also live in the AS3 namespace 2021-09-18 18:37:46 +02:00
lukaszN 5e5d8e4fff avm2: String concat, lastIndexOf, indexOf, fromCharCode 2021-09-18 18:37:46 +02:00
relrelb 1ab953887c avm1: Simplify `Value::abstract_eq`
Make it return `bool` instead of a `Value` that can be either `true`
or `false`.
2021-09-18 17:47:25 +02:00
Giles Cope 623654cd99 Adding back getrandom 2021-09-18 15:28:24 +02:00
Giles Cope 42c2b40052 unused deps 2021-09-18 15:28:24 +02:00
Chris Midgley 758d84f549 avm2: fix button typo 2021-09-18 15:26:52 +02:00
Chris Midgley 909428943b avm2: implement bkpt, bkptline, timestamp as no-ops 2021-09-17 23:06:59 +02:00
relrelb ff1c29d952 avm1: Simplify `Value::abstract_lt`
* Change its return type to `Option<bool>`.
* Use Rust's `f64::partial_cmp` to compare two numbers, which should
be more efficient.
2021-09-16 13:46:04 +03:00
relrelb 08b6cf543a web: Guard logs behind a `log_enabled!()` macro
These logs perform somewhat expensive evaluation (crossing the Wasm-
JS boundary). So use the cheaper `log_enabled!()` macro to avoid
evaluation if the relevant log level is not enabled.
2021-09-16 02:56:18 -07:00
Chris Midgley 2dd83c23e8 avm2: add more opcodes
Taken from https://jindrapetrik.github.io/as3_pcode_instructions.en.html
2021-09-16 02:51:04 -07:00
Chris Midgley d52a350b9b avm2: reorder opcodes to be alphabetical 2021-09-16 02:51:04 -07:00