-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
Introduce PropertyKey for field acces, fix #172 (quotes around displayed strings) #373
Conversation
I have no idea how, but changing the |
This might be related to the fact that we use @HalidOdat @jasonwilliams what do you think? |
Yes we certainly want this, even for debugging purposes. |
The question is why is this giving an error. Are we using a |
It doesn't seem to be related to How and why this might even happen, however, is a mystery. |
After reviewing what's happening here, I saw that many tests fail:
So it seems that we use What do you think? |
Does this work now that #381 was merged? |
No, the samer error remains, global objects are |
I have some free time again, I'd like to fix this. Create a wrapper struct, implementing Line 211 in d837e04
to call v.display() instead, yes?
|
I think this is the best solution for now, yes. What do you think, @HalidOdat, @jasonwilliams ? |
I think so too! |
…ring" This reverts commit 84bedd7.
Allow separation of internal representation from REPL representation
Since boa/boa/src/builtins/value/mod.rs Line 833 in d837e04
I don't know in which places Let me know what can be improved! |
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 good!
About the log_string_from
I think we should change it to take in a &Value
instead of &ValueData
I'm having an issue with this, the boa/boa/src/builtins/value/mod.rs Line 979 in c8218dd
|
Hmmm. For now lets leave |
I have pushed it, but it leaves an issue, objects that have fields of type let a = {0: "0"};
a should display |
The problem is that we implement The I'll create a PR addressing this issue ASAP. |
Moved ValueDisplay: builtins/value/mod.rs -> builtins/value/display.rs
Codecov Report
@@ Coverage Diff @@
## master #373 +/- ##
==========================================
+ Coverage 71.04% 71.11% +0.06%
==========================================
Files 177 176 -1
Lines 11439 11503 +64
==========================================
+ Hits 8127 8180 +53
- Misses 3312 3323 +11
Continue to review full report at Codecov.
|
This is definitely a step in the right direction :) I don't we need a fn set_field(&mut self, field: F, value: V)
where
F: Into<PropertyKey>,
V: Into<Value>
{
// ...
} there are only a small amount of places where we call And also since we take a |
@RageKnify I did the suggested changes, and fixed the test (it was a call to Display to_string that put the regex in |
Sorry, forgot to look at my notifications and tried doing what was done already. |
Remove/set str field
I'll do some final touch ups and add some tests to increase coverage. |
One thing I wanted to double check, when you applied your proposed changes you changed boa/boa/src/builtins/value/mod.rs Line 658 in 5d4d8fe
Can I go ahead and set it to return the value while using a clone of the value as the argument for |
Good catch. Yes. I guess I made a mistake 😅 |
Test: Add tests for Number and Boolean Fix: Fix return and remove old comments in Value::set_field Refactor: Change Object::set to receive &PropertyKey like its other methods, remove unnecessary &s
I wasn't sure how to test the more internal functions, if you think tests should be added and have any ideas let me know. |
What exactly do you mean by internal functions? if you mean |
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 looks great! Almost ready to merge :D
@HalidOdat should I inline the conversion functions that match on enums or only the ones without branching? |
Docs: Add description of PropertyKey Refactor: Add #[inline] for short PropertyKey functions Refactor: Add #[inline] for short conversions
Yes. If the function contains one condition/match (small) it is worth inlining than having function call. #[inline] is a hint to the compiler. |
Benchmarks
As expected there is a really nice increase in performance |
This is good to go. this is going to make it easier to implementing #591 Thanks for the contribution @RageKnify :) |
No description provided.