Skip to content

Commit cc6fbc5

Browse files
committed
removed duplicate general function definition; moved 'literal-function-constructor' above 'literal-function-call' so function definitions are detected first (otherwise the 'function' keyword can be confused with a method name)
1 parent 2638cfc commit cc6fbc5

2 files changed

Lines changed: 3 additions & 46 deletions

File tree

‎JavaScriptNext.YAML-tmLanguage‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ repository:
113113
- include: '#literal-module'
114114
# before function calls, to differentiate methods from them
115115
- include: '#literal-method'
116+
- include: '#literal-function-constructor'
116117

117118
- include: '#literal-function-call'
118-
- include: '#literal-function-constructor'
119119

120120
- include: '#literal-labels'
121121
- include: '#literal-variable'
@@ -282,21 +282,6 @@ repository:
282282
'2': {name: meta.group.braces.round.function.arguments.js}
283283
'3': {name: meta.brace.round.js}
284284

285-
# e.g. function(one,two,...)\n?{...}
286-
- name: meta.function.js
287-
begin: |-
288-
(?x)
289-
\b(function\*?)
290-
(?=
291-
(?:\b(?:[_$a-zA-Z][_$\w]*))? \s* # The function name
292-
\(.*?\) # The properties that the function accepts
293-
)
294-
beginCaptures:
295-
'1': {name: storage.type.function.js}
296-
end: (?<=})(\s*\n)?
297-
patterns:
298-
- include: source.js
299-
300285
# ES6 methods, e.g. abc(x, y, z){
301286
- name: meta.method.js
302287
match: |-

‎JavaScriptNext.tmLanguage‎

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@
304304
</dict>
305305
<dict>
306306
<key>include</key>
307-
<string>#literal-function-call</string>
307+
<string>#literal-function-constructor</string>
308308
</dict>
309309
<dict>
310310
<key>include</key>
311-
<string>#literal-function-constructor</string>
311+
<string>#literal-function-call</string>
312312
</dict>
313313
<dict>
314314
<key>include</key>
@@ -1225,34 +1225,6 @@
12251225
<key>name</key>
12261226
<string>meta.function-call.method.without-arguments.js</string>
12271227
</dict>
1228-
<dict>
1229-
<key>begin</key>
1230-
<string>(?x)
1231-
\b(function\*?)
1232-
(?=
1233-
(?:\b(?:[_$a-zA-Z][_$\w]*))? \s* # The function name
1234-
\(.*?\) # The properties that the function accepts
1235-
)</string>
1236-
<key>beginCaptures</key>
1237-
<dict>
1238-
<key>1</key>
1239-
<dict>
1240-
<key>name</key>
1241-
<string>storage.type.function.js</string>
1242-
</dict>
1243-
</dict>
1244-
<key>end</key>
1245-
<string>(?&lt;=})(\s*\n)?</string>
1246-
<key>name</key>
1247-
<string>meta.function.js</string>
1248-
<key>patterns</key>
1249-
<array>
1250-
<dict>
1251-
<key>include</key>
1252-
<string>source.js</string>
1253-
</dict>
1254-
</array>
1255-
</dict>
12561228
<dict>
12571229
<key>captures</key>
12581230
<dict>

0 commit comments

Comments
 (0)