Skip to content

Commit 39de586

Browse files
Merge pull request dotnet#143 from DustinCampbell/issue-142
Fix issue with async lambda with single parameter assigned to dotted name
2 parents 7b087ff + ad7514e commit 39de586

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

grammars/csharp.tmLanguage

+1
Original file line numberDiff line numberDiff line change
@@ -3424,6 +3424,7 @@
34243424
)
34253425
)\s+
34263426
(\g<identifier>)\s*
3427+
(?!=>)
34273428
(?=,|;|=|\))</string>
34283429
<key>beginCaptures</key>
34293430
<dict>

grammars/csharp.tmLanguage.cson

+1
Original file line numberDiff line numberDiff line change
@@ -2087,6 +2087,7 @@ repository:
20872087
)
20882088
)\\s+
20892089
(\\g<identifier>)\\s*
2090+
(?!=>)
20902091
(?=,|;|=|\\))
20912092
'''
20922093
beginCaptures:

src/csharp.tmLanguage.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,7 @@ repository:
12651265
)
12661266
)\s+
12671267
(\g<identifier>)\s*
1268+
(?!=>)
12681269
(?=,|;|=|\))
12691270
beginCaptures:
12701271
'1': { name: storage.modifier.cs }

test/expressions.tests.ts

+21
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,27 @@ describe("Grammar", () => {
376376
]);
377377
});
378378

379+
it("async lambda assigned to dotted name (issue #142)", () => {
380+
const input = Input.InMethod(`Something.listener = async args => { return true; };`);
381+
const tokens = tokenize(input);
382+
383+
tokens.should.deep.equal([
384+
Token.Variables.Object("Something"),
385+
Token.Punctuation.Accessor,
386+
Token.Variables.Property("listener"),
387+
Token.Operators.Assignment,
388+
Token.Keywords.Modifiers.Async,
389+
Token.Identifiers.ParameterName("args"),
390+
Token.Operators.Arrow,
391+
Token.Punctuation.OpenBrace,
392+
Token.Keywords.Control.Return,
393+
Token.Literals.Boolean.True,
394+
Token.Punctuation.Semicolon,
395+
Token.Punctuation.CloseBrace,
396+
Token.Punctuation.Semicolon
397+
]);
398+
});
399+
379400
it("anonymous method with no parameter list (assignment)", () => {
380401
const input = Input.InMethod(`Action a = delegate { };`);
381402
const tokens = tokenize(input);

0 commit comments

Comments
 (0)