File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -1285,7 +1285,8 @@ namespace ts {
1285
1285
}
1286
1286
1287
1287
function isDottedName ( node : Expression ) : boolean {
1288
- return node . kind === SyntaxKind . Identifier || node . kind === SyntaxKind . PropertyAccessExpression && isDottedName ( ( < PropertyAccessExpression > node ) . expression ) ;
1288
+ return node . kind === SyntaxKind . Identifier || node . kind === SyntaxKind . ThisKeyword ||
1289
+ node . kind === SyntaxKind . PropertyAccessExpression && isDottedName ( ( < PropertyAccessExpression > node ) . expression ) ;
1289
1290
}
1290
1291
1291
1292
function bindExpressionStatement ( node : ExpressionStatement ) : void {
Original file line number Diff line number Diff line change @@ -16838,16 +16838,18 @@ namespace ts {
16838
16838
// that reference function, method, class or value module symbols; or variable, property or
16839
16839
// parameter symbols with declarations that have explicit type annotations. Such references are
16840
16840
// resolvable with no possibility of triggering circularities in control flow analysis.
16841
- if (node.kind === SyntaxKind.Identifier) {
16842
- const symbol = getResolvedSymbol(<Identifier>node);
16843
- return getExplicitTypeOfSymbol(symbol.flags & SymbolFlags.Alias ? resolveAlias(symbol) : symbol);
16844
- }
16845
- if (node.kind === SyntaxKind.PropertyAccessExpression) {
16846
- const type = getTypeOfDottedName((<PropertyAccessExpression>node).expression);
16847
- if (type) {
16848
- const prop = getPropertyOfType(type, (<PropertyAccessExpression>node).name.escapedText);
16849
- return prop && getExplicitTypeOfSymbol(prop);
16850
- }
16841
+ switch (node.kind) {
16842
+ case SyntaxKind.Identifier:
16843
+ const symbol = getResolvedSymbol(<Identifier>node);
16844
+ return getExplicitTypeOfSymbol(symbol.flags & SymbolFlags.Alias ? resolveAlias(symbol) : symbol);
16845
+ case SyntaxKind.ThisKeyword:
16846
+ return checkThisExpression(node);
16847
+ case SyntaxKind.PropertyAccessExpression:
16848
+ const type = getTypeOfDottedName((<PropertyAccessExpression>node).expression);
16849
+ if (type) {
16850
+ const prop = getPropertyOfType(type, (<PropertyAccessExpression>node).name.escapedText);
16851
+ return prop && getExplicitTypeOfSymbol(prop);
16852
+ }
16851
16853
}
16852
16854
}
16853
16855
Original file line number Diff line number Diff line change @@ -3211,6 +3211,7 @@ namespace ts {
3211
3211
const type = parseType ( ) ;
3212
3212
if ( typePredicateVariable ) {
3213
3213
const node = < TypePredicateNode > createNode ( SyntaxKind . TypePredicate , typePredicateVariable . pos ) ;
3214
+ node . assertsModifier = undefined ;
3214
3215
node . parameterName = typePredicateVariable ;
3215
3216
node . type = type ;
3216
3217
return finishNode ( node ) ;
@@ -3232,9 +3233,7 @@ namespace ts {
3232
3233
const node = < TypePredicateNode > createNode ( SyntaxKind . TypePredicate ) ;
3233
3234
node . assertsModifier = parseExpectedToken ( SyntaxKind . AssertsKeyword ) ;
3234
3235
node . parameterName = parseIdentifier ( ) ;
3235
- if ( parseOptional ( SyntaxKind . IsKeyword ) ) {
3236
- node . type = parseType ( ) ;
3237
- }
3236
+ node . type = parseOptional ( SyntaxKind . IsKeyword ) ? parseType ( ) : undefined ;
3238
3237
return finishNode ( node ) ;
3239
3238
}
3240
3239
You can’t perform that action at this time.
0 commit comments