Skip to content

Commit a118ec7

Browse files
zdenkoGeoffreyBooth
authored andcommitted
[CS2] fix for “do super in constructor” bug (#4627)
* bug fix 'do super' in constructor * improve regex
1 parent 6d21dc5 commit a118ec7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/coffeescript/lexer.js

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lexer.coffee

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ exports.Lexer = class Lexer
136136
if id is 'default' and @seenExport and @tag() in ['EXPORT', 'AS']
137137
@token 'DEFAULT', id
138138
return id.length
139+
if id is 'do' and regExSuper = /^(\s*super)(?!\(\))/.exec @chunk[3...]
140+
@token 'SUPER', 'super'
141+
@token 'CALL_START', '('
142+
@token 'CALL_END', ')'
143+
[input, sup] = regExSuper
144+
return sup.length + 3
139145

140146
prev = @prev()
141147

0 commit comments

Comments
 (0)