File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -2397,9 +2397,6 @@ module ts {
2397
2397
else {
2398
2398
parseExpected ( SyntaxKind . OpenParenToken ) ;
2399
2399
}
2400
- // It is an error to have a trailing comma in an argument list. However, the checker
2401
- // needs evidence of a trailing comma in order to give good results for signature help.
2402
- // That is why we do not allow a trailing comma, but we "preserve" a trailing comma.
2403
2400
callExpr . arguments = parseDelimitedList ( ParsingContext . ArgumentExpressions ,
2404
2401
parseArgumentExpression , /*allowTrailingComma*/ false ) ;
2405
2402
parseExpected ( SyntaxKind . CloseParenToken ) ;
@@ -2627,9 +2624,6 @@ module ts {
2627
2624
parseExpected ( SyntaxKind . NewKeyword ) ;
2628
2625
node . func = parseCallAndAccess ( parsePrimaryExpression ( ) , /* inNewExpression */ true ) ;
2629
2626
if ( parseOptional ( SyntaxKind . OpenParenToken ) || token === SyntaxKind . LessThanToken && ( node . typeArguments = tryParse ( parseTypeArgumentsAndOpenParen ) ) ) {
2630
- // It is an error to have a trailing comma in an argument list. However, the checker
2631
- // needs evidence of a trailing comma in order to give good results for signature help.
2632
- // That is why we do not allow a trailing comma, but we "preserve" a trailing comma.
2633
2627
node . arguments = parseDelimitedList ( ParsingContext . ArgumentExpressions ,
2634
2628
parseArgumentExpression , /*allowTrailingComma*/ false ) ;
2635
2629
parseExpected ( SyntaxKind . CloseParenToken ) ;
Original file line number Diff line number Diff line change @@ -241,6 +241,12 @@ module ts.SignatureHelp {
241
241
return undefined ;
242
242
}
243
243
244
+ // If the node is not a subspan of its parent, this is a big problem.
245
+ // There have been crashes that might be caused by this violation.
246
+ if ( n . pos < n . parent . pos || n . end > n . parent . end ) {
247
+ Debug . fail ( "Node of kind " + SyntaxKind [ n . kind ] + " is not a subspan of its parent of kind " + SyntaxKind [ n . parent . kind ] ) ;
248
+ }
249
+
244
250
var argumentInfo = getImmediatelyContainingArgumentInfo ( n ) ;
245
251
if ( argumentInfo ) {
246
252
return argumentInfo ;
Original file line number Diff line number Diff line change @@ -27,11 +27,18 @@ module ts {
27
27
// for the position of the relevant node (or comma).
28
28
var syntaxList = forEach ( node . parent . getChildren ( ) , c => {
29
29
// find syntax list that covers the span of the node
30
- if ( c . kind == SyntaxKind . SyntaxList && c . pos <= node . pos && c . end >= node . end ) {
30
+ if ( c . kind === SyntaxKind . SyntaxList && c . pos <= node . pos && c . end >= node . end ) {
31
31
return c ;
32
32
}
33
33
} ) ;
34
34
35
+ // syntaxList should not be undefined here. If it is, there is a problem. Find out if
36
+ // there at least is a child that is a list.
37
+ if ( ! syntaxList ) {
38
+ Debug . assert ( findChildOfKind ( node . parent , SyntaxKind . SyntaxList ) ,
39
+ "Node of kind " + SyntaxKind [ node . parent . kind ] + " has no list children" ) ;
40
+ }
41
+
35
42
return syntaxList ;
36
43
}
37
44
You can’t perform that action at this time.
0 commit comments