-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
feat: Implement Array.prototype.toString #218
Conversation
src/lib/builtins/array.rs
Outdated
ValueData::String(ref s) => (*s).clone(), | ||
_ => "".to_string(), | ||
}, | ||
Err(v) => format!("{}: {}", "error", v.to_string()), |
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.
No need for "error"
to be a separate param, you can change the template to "error: {}"
.
Also, no need for .to_string()
, v
will be formatted accordingly to its value anyway.
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.
nice advice
No need for
"error"
to be a separate param, you can change the template to"error: {}"
.Also, no need for
.to_string()
,v
will be formatted accordingly to its value anyway.
nice advice,thank you!
Looks good, sync you branch with master so the pipeline runs, and we are all set |
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, sync you branch with master so the pipeline runs, and we are all set
Array.prototype.toString should be passed the tests like jerryscript's。But without enough continuous time,I had to implement a simplified one first。Next,I will improve it.
src/lib/builtins/array.rs
Outdated
ValueData::String(ref s) => (*s).clone(), | ||
_ => "".to_string(), | ||
}, | ||
Err(v) => format!("{}: {}", "error", v.to_string()), |
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.
nice advice
No need for
"error"
to be a separate param, you can change the template to"error: {}"
.Also, no need for
.to_string()
,v
will be formatted accordingly to its value anyway.
nice advice,thank you!
I am a rust newbie and my code may not be good. But I will continue to improve this code.