Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit c4f7a5f

Browse files
author
Wliu
authored
Merge pull request #393 from MaximSokolov/fix-constructor-boundary
🐛 Fix 'constructor' boundary
2 parents f9520c4 + 883e1e0 commit c4f7a5f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: grammars/javascript.cson

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@
424424
]
425425
}
426426
{
427-
'begin': '(?=\\b(constructor)\\s*)'
427+
'begin': '(?=\\bconstructor\\b\\s*)'
428428
'end': '(?<=})'
429429
'patterns': [
430430
{

Diff for: spec/javascript-spec.coffee

+3
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,9 @@ describe "Javascript grammar", ->
10491049
expect(tokens[6]).toEqual value: ')', scopes: ['source.js', 'meta.function.js', 'meta.parameters.js', 'punctuation.definition.parameters.end.bracket.round.js']
10501050
expect(tokens[10]).toEqual value: 'this', scopes: ['source.js', 'variable.language.js']
10511051

1052+
{tokens} = grammar.tokenizeLine('constructorABC: {}')
1053+
expect(tokens[0]).not.toEqual value: 'constructor', scopes: ['source.js', 'meta.function.js', 'entity.name.function.constructor.js']
1054+
10521055
it "tokenizes named function expressions", ->
10531056
{tokens} = grammar.tokenizeLine('var func = function foo(){}')
10541057
expect(tokens[0]).toEqual value: 'var', scopes: ['source.js', 'storage.type.var.js']

0 commit comments

Comments
 (0)