-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
[Merged by Bors] - Feature JsFunction
#2015
Conversation
Test262 conformance changesVM implementation
|
Codecov Report
@@ Coverage Diff @@
## main #2015 +/- ##
==========================================
- Coverage 43.86% 43.85% -0.02%
==========================================
Files 212 213 +1
Lines 18758 18767 +9
==========================================
+ Hits 8229 8231 +2
- Misses 10529 10536 +7
Continue to review full report at Codecov.
|
Benchmark for e45f1fdClick to view benchmark
|
6673621
to
47fbfba
Compare
Benchmark for 396ad57Click to view benchmark
|
47fbfba
to
1396564
Compare
Benchmark for 7efac74Click to view benchmark
|
1396564
to
2e236a1
Compare
Benchmark for 3b74e5dClick to view benchmark
|
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.
Looks very good, but I'm missing some documentation on public methods (of JsFunction
and other public APIs) in order to make this very usable, maybe with some example code, for instance.
2e236a1
to
452a91f
Compare
452a91f
to
257097b
Compare
Benchmark for 3af59f7Click to view benchmark
|
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.
This is good for me :) Let's see what the rest thinks.
bors r+ |
This PR adds `JsFunction` wrapper around JavaScript `Function` object, like #1746 With this PR we can distinguish between regular object and function object when we need, such as accessors (because they always need to be functions), predicates in `JsArray` methods like `map`, `find`, etc. With this abstraction we leverage the type system of rust which cleans the API making intentions clear. It changes the following: - Make methods that take predicate/callback function take `JsFunction`s - Make `.accessor()` and `.static_accessor()` take `Option<JsFunction>` - Make `FunctionBuilder` return `JsFunction` - Make `ConstructorBuilder` return `JsFunction` - Make `ClassBuilder` return `JsFunction`
Pull request successfully merged into main. Build succeeded: |
This PR adds `JsFunction` wrapper around JavaScript `Function` object, like #1746 With this PR we can distinguish between regular object and function object when we need, such as accessors (because they always need to be functions), predicates in `JsArray` methods like `map`, `find`, etc. With this abstraction we leverage the type system of rust which cleans the API making intentions clear. It changes the following: - Make methods that take predicate/callback function take `JsFunction`s - Make `.accessor()` and `.static_accessor()` take `Option<JsFunction>` - Make `FunctionBuilder` return `JsFunction` - Make `ConstructorBuilder` return `JsFunction` - Make `ClassBuilder` return `JsFunction`
This PR adds
JsFunction
wrapper around JavaScriptFunction
object, like #1746With this PR we can distinguish between regular object and function object when we need, such as accessors (because they always need to be functions), predicates in
JsArray
methods likemap
,find
, etc. With this abstraction we leverage the type system of rust which cleans the API making intentions clear.It changes the following:
JsFunction
s.accessor()
and.static_accessor()
takeOption<JsFunction>
FunctionBuilder
returnJsFunction
ConstructorBuilder
returnJsFunction
ClassBuilder
returnJsFunction