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

feat(ecmascript): String.prototype.split() #417

Merged
merged 19 commits into from
Sep 26, 2024

Conversation

oscarotero
Copy link
Contributor

Please, bear with me. I'm learning Rust and I don't have much experience with the borrow checker.

@oscarotero oscarotero marked this pull request as ready for review September 19, 2024 18:04
@oscarotero
Copy link
Contributor Author

@aapoalas I think it's ready to review.

btw, what is the recommended way to test the function? I'd like to have a file to execute (like cargo run -- eval testing.js) to manually test the function, but there isn't a console.log() that I can use to see the result.

@aapoalas
Copy link
Collaborator

nova_cli has a print function you can use.

@aapoalas
Copy link
Collaborator

Oh, oops. I only now realized this is actually your first PR here! Sorry, I wasn't paying attention and thought you were behind #416 as well!

Welcome, and great work getting yourself up from the ground with the borrow checker! And sorry about the nitpicking on the spec text: It's just a good idea to stick fairly close to it. I don't mean it personally <3

@oscarotero
Copy link
Contributor Author

Thanks for your review @aapoalas
Writing a JS engine is harder than I thought :D

I'm learning the codebase of the repo, how to implement and test things, and now I just learned that the numbers in the comments corresponds to the steps in the ecma262 specs.

I'll continue working on this.

@aapoalas
Copy link
Collaborator

I'm learning the codebase of the repo, how to implement and test things, and now I just learned that the numbers in the comments corresponds to the steps in the ecma262 specs.

I'm sorry! This is definitely my failing! I should add some more about this to the CONTRIBUTING.md and maybe elsewhere as well so that new contributors have an easier way in.

@oscarotero
Copy link
Contributor Author

Thanks for all your help @aapoalas , I'm learning a lot

There're still much work to do yet. There are some cases that are not explained in the spec but they are failing in the tests.

For example, when the this variable is not a string, I didn't see anything in the spec to explain how to handle that, and the test are not clear. I'll continue the next week.

aapoalas
aapoalas previously approved these changes Sep 20, 2024
Copy link
Collaborator

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a bunch to comment on, but nothing terribly out of whack. Thank you very much, and welcome again to Nova!

Absolutely feel free to keep on trying to solve any remaining cases: The eval-test command is very useful for testing individual test262 case. eg.

cargo build && cargo run --bin test262 eval-test built-ins/String/prototype/split/argument-is-new-reg-exp-and-instance-is-string-hello.js

@oscarotero
Copy link
Contributor Author

@aapoalas I have fixed a lot of tests due a stupid bug: I was getting the limit argument with args.get(0) instead of args.get(1). The only failing tests are those related with regexp, Symbol.split and other advanced edge cases.

I've also applied your suggestions. The only unresolved comment is the one related with UTF-16.

@aapoalas
Copy link
Collaborator

@aapoalas I have fixed a lot of tests due a stupid bug: I was getting the limit argument with args.get(0) instead of args.get(1). The only failing tests are those related with regexp, Symbol.split and other advanced edge cases.

I've also applied your suggestions. The only unresolved comment is the one related with UTF-16.

Sorry, it's taking me some time to get to re-reviewing this. I've been buried under an avalanche of grapes during the last few days.

@aapoalas aapoalas changed the title String.prototype.split() feat(ecmascript): String.prototype.split() Sep 26, 2024
@aapoalas aapoalas changed the title feat(ecmascript): String.prototype.split() feat(ecmascript): String.prototype.split() Sep 26, 2024
@oscarotero
Copy link
Contributor Author

No problem! I saw the pictures and completely understand your priorities! 🍇

aapoalas
aapoalas previously approved these changes Sep 26, 2024
Copy link
Collaborator

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpicks / thoughts / questions.

But looks good to me! Thank you for this, great work!

@aapoalas aapoalas merged commit 9bf18a2 into trynova:main Sep 26, 2024
1 check passed
@aapoalas
Copy link
Collaborator

Thank you again and great work! <3

@oscarotero oscarotero deleted the string/split branch September 27, 2024 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants