Merge pull request #9271 from Microsoft/classify_this
Classify `this` in parameter position as a keyword
This commit is contained in:
commit
420b920438
2 changed files with 15 additions and 1 deletions
|
@ -7541,7 +7541,8 @@ namespace ts {
|
|||
return;
|
||||
case SyntaxKind.Parameter:
|
||||
if ((<ParameterDeclaration>token.parent).name === token) {
|
||||
return ClassificationType.parameterName;
|
||||
const isThis = token.kind === SyntaxKind.Identifier && (<Identifier>token).originalKeywordKind === SyntaxKind.ThisKeyword;
|
||||
return isThis ? ClassificationType.keyword : ClassificationType.parameterName;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
13
tests/cases/fourslash/classifyThisParameter.ts
Normal file
13
tests/cases/fourslash/classifyThisParameter.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////function f(this){}
|
||||
|
||||
var c = classification;
|
||||
verify.syntacticClassificationsAre(
|
||||
c.keyword("function"),
|
||||
c.identifier("f"),
|
||||
c.punctuation("("),
|
||||
c.keyword("this"),
|
||||
c.punctuation(")"),
|
||||
c.punctuation("{"),
|
||||
c.punctuation("}"));
|
Loading…
Reference in a new issue