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

implement string.match(regexp) #131

Merged
merged 3 commits into from
Oct 15, 2019
Merged

implement string.match(regexp) #131

merged 3 commits into from
Oct 15, 2019

Conversation

muskuloes
Copy link
Contributor

@muskuloes muskuloes commented Oct 4, 2019

an implementation of strings.match from issue #114

@jasonwilliams
Copy link
Member

Thanks, im just looking into the benchmarks issue so bear with me

@jasonwilliams
Copy link
Member

I've made some changes to the benchmarks Action, could you try rebasing and pushing again?

@muskuloes
Copy link
Contributor Author

The benchmarks still failed.

@jasonwilliams
Copy link
Member

Ugh...
bear with me, might be a couple of days

@muskuloes muskuloes mentioned this pull request Oct 5, 2019
Comment on lines 432 to 433
let slots = &*obj.borrow().internal_slots;
if slots.get("RegExpMatcher").is_some() {
Copy link
Member

@jasonwilliams jasonwilliams Oct 7, 2019

Choose a reason for hiding this comment

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

You could use .get_internal_slot() here, which gives you either the value or undefined.
You will always get a value back so be careful here.

Copy link
Member

Choose a reason for hiding this comment

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

i think you also want to handle the case where RegExpMatcher isn't there.
(An object was passed but it wasn't a RegExp)

if let Some(flags) = slots.get("OriginalFlags") {
regex_flags = from_value(flags.clone()).unwrap();
}
}
Copy link
Member

Choose a reason for hiding this comment

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

You could probably just return undefined here if RegExpMatcher isn't there

@muskuloes
Copy link
Contributor Author

Hi, should I move the core functionality to regexp.rs as per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/@@match as well?

@jasonwilliams
Copy link
Member

jasonwilliams commented Oct 8, 2019

Yeap, although we don't have support for Symbols yet.
How are you planning to move it?

@muskuloes
Copy link
Contributor Author

Yes. I will. I'll push the update over the weekend.

@muskuloes
Copy link
Contributor Author

PR updated

@jasonwilliams
Copy link
Member

This is really awesome, thanks so much, looks clean and the tests are great

@jasonwilliams jasonwilliams merged commit a93f05c into boa-dev:master Oct 15, 2019
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