[CS2] fix for “do super in constructor” bug#4627
Conversation
GeoffreyBooth
left a comment
There was a problem hiding this comment.
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.
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.
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 superin constructor)