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

Refactor: Value::to_object to return GcObject #712

Merged
merged 2 commits into from
Sep 27, 2020

Conversation

RageKnify
Copy link
Member

This Pull Request starts the work on #577.

It changes the following:

  • Value::to_object now returns Result<GcObject> rather than Result<Value>
  • Move Value::new_object_from_prototype to Object::new_object_from_prototype
  • Minor changes in other files to accomodate the new API

I assume those minor changes will be cleaned up once the separation of the Object and Value API is complete.

Start work on boa-dev#577
Value::new_object_from_prototype becomes Object::new_object_from_prototype

Introduce some small changes in other files to accommodate for the change
in API, I assume once boa-dev#577 is finished everything will be cleaned up
@codecov
Copy link

codecov bot commented Sep 24, 2020

Codecov Report

Merging #712 into master will increase coverage by 0.10%.
The diff coverage is 80.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #712      +/-   ##
==========================================
+ Coverage   71.69%   71.79%   +0.10%     
==========================================
  Files         199      199              
  Lines       13865    13943      +78     
==========================================
+ Hits         9941    10011      +70     
- Misses       3924     3932       +8     
Impacted Files Coverage Δ
boa/src/builtins/object/mod.rs 51.80% <60.00%> (+0.61%) ⬆️
boa/src/object/mod.rs 27.67% <80.00%> (+1.69%) ⬆️
boa/src/value/mod.rs 69.55% <81.81%> (-0.13%) ⬇️
boa/src/builtins/array/mod.rs 76.65% <100.00%> (ø)
boa/src/exec/call/mod.rs 72.41% <100.00%> (ø)
boa/src/exec/field/mod.rs 100.00% <100.00%> (ø)
boa/src/builtins/symbol/mod.rs 80.13% <0.00%> (-2.98%) ⬇️
boa/src/object/gcobject.rs 73.10% <0.00%> (-0.81%) ⬇️
boa/src/property/mod.rs 49.65% <0.00%> (-0.70%) ⬇️
boa/src/syntax/lexer/mod.rs 66.00% <0.00%> (-0.67%) ⬇️
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81089d1...d7d3b4d. Read the comment docs.

@HalidOdat HalidOdat added API enhancement New feature or request execution Issues or PRs related to code execution technical debt labels Sep 24, 2020
@RageKnify
Copy link
Member Author

RageKnify commented Sep 25, 2020

There's one thing I started doubting after implementing, it may be more appropriate for the return type to be Object and then to wrap it in a GcObject only when required. What do you think @HalidOdat ?

boa/src/builtins/array/mod.rs Outdated Show resolved Hide resolved
boa/src/builtins/array/mod.rs Outdated Show resolved Hide resolved
boa/src/builtins/object/mod.rs Outdated Show resolved Hide resolved
boa/src/object/mod.rs Outdated Show resolved Hide resolved
@HalidOdat
Copy link
Member

There's one thing I started doubting after implementing, it may be more appropriate for the return type to be Object and then to wrap it in a GcObject only when required. What do you think @HalidOdat ?

You mean new_object_from_prototype, right? I thick so too, but for .to_object it has to return GcObject
Also I think it's best to rename new_object_from_prototype to with_prototype so when we construct it its

let object = Object::with_prototype(Value::null(), ...);

@HalidOdat HalidOdat merged commit 0348ba9 into boa-dev:master Sep 27, 2020
@RageKnify RageKnify deleted the refactor/to_object branch September 27, 2020 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API enhancement New feature or request execution Issues or PRs related to code execution technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants