-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[CS2] fix for “do super
in constructor” bug
#4627
Conversation
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.
Should use test
instead of exec
.
I improved RegExp and used |
@token 'CALL_START', '(' | ||
@token 'CALL_END', ')' | ||
[input, sup] = regExSuper | ||
return sup.length + 3 |
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.
When would sup.length
not be 5? And 3 is the length of do
plus a space? What if someone types do super
with two or more spaces between the words?
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.
Yes, 3 is the length of do
plus a space.
The \s*
in \s*super
was added to catch all spaces between do
and super
.
So, when do
is detected, the regex will match zero or more spaces before super
, starting from third characters of current match e.g. do␣
.
If you change line 144 in lexer
to return 8
it will work for one space, but will fail when you add more spaces, e.g. do␣␣␣␣super
.
do super
in constructor” bug
Verified that this works with any number of whitespace characters between |
A small fix for the #4623 (
do super
in constructor)