-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
fix: 209 Calling new Array
with 1 argument doesn't work properly
#233
Conversation
ew Array with 1 argument doesn't work properly
src/lib/builtins/array.rs
Outdated
.writable(true) | ||
.configurable(false) | ||
.enumerable(false); | ||
let length = if args.len() > 1 { |
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.
You can extract just the length and write the logic for creating the property once, e.g.
let n = if args.len() > 1 { args.len() } ...
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.
LGTM! Maybe a match
statement would be a better fit instead of the if
statements and would also allow you to recapture the value inside the pattern match.
Not a big change but would make it easier to read and express intent better IMO.
Thanks for your advice! I will improve it later. Because of Chinese New Year and my hometown's slow network,It will take a little time. |
Looks good but can you look for some commented tests for this or add some if they don't exist? |
Ok, I will add it later. |
There is still some problems when I add tests like jerryscripts'. It will will take more times to fix this problems. |
#209