Skip to content

Commit c4f33bc

Browse files
committed
Fixed anonymous functions not pushing to code scope
1 parent 52409a4 commit c4f33bc

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

AngelScript.sublime-syntax

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,24 @@ contexts:
260260
- match: '\b{{operators_words}}\b'
261261
scope: keyword.operator.word
262262

263+
- match: '\b(function)(?=\()'
264+
scope: storage.type.function
265+
push:
266+
- include: global
267+
- match: '\('
268+
scope: punctuation.section.parens.begin
269+
push:
270+
- match: '{{identifier}}'
271+
scope: variable.parameter
272+
- match: ','
273+
scope: punctuation.separator
274+
- match: '\)'
275+
scope: punctuation.section.parens.end
276+
pop: true
277+
- match: '{'
278+
scope: punctuation.section.block.begin
279+
set: code-scope
280+
263281
- include: expression-has-functioncall
264282

265283
- match: '\b{{number}}\b'

syntax_test_stuff.as

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,18 @@ void bitstuff()
139139
this.x = 1;
140140
// <- variable.language
141141

142+
r.sort(function(a, b) { return true; });
143+
// ^^^^^^^^ storage.type.function
144+
// ^ punctuation.section.parens.begin
145+
// ^ variable.parameter
146+
// ^ punctuation.separator
147+
// ^ variable.parameter
148+
// ^ punctuation.section.parens.end
149+
// ^ punctuation.section.block.begin
150+
// ^ punctuation.section.block.end
151+
// ^ punctuation.section.parens.end
152+
// ^ punctuation.terminator
153+
142154
for (uint i = 0; i < m_skills.length(); i++)
143155
stuff();
144156
// <- entity.name.function

0 commit comments

Comments
 (0)