-
Notifications
You must be signed in to change notification settings - Fork 224
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
lastIndex unused #205
Comments
OK, I was mistaken here. The However, given that There isn't really anything "wrong" with the current version (it still does what it is supposed to). In my version I rewrote it a little bit just to simplify it. With my changes applied to
|
Thanks for the comment. I'll revisit this aspect of the implementation. |
In my current work on my evaluator, I noticed this line. I'm pretty confident that
lastIndex
is completely unused. It is initialized to0
and never changed. Furthermore, the comparisons betweenre.lastIndex
andexpr.value.lastindex
are meaningless because those are the same variable. The check on the value ofre.lastIndex
vs.str.length
is also unnecessary since the only possible value forre.lastIndex
is zero. So the only way it can be true (and returnundefined
) is ifstr.length===0
. But in that case, there will be no match (which means you'd never get to that check).I've removed all references to
lastIndex
in my version and the test suite still passes. So I'm not sure what is intended here, but it doesn't seem likelastIndex
accomplishes anything and the test suite certainly doesn't seem to require it.The text was updated successfully, but these errors were encountered: