@@ -114,29 +114,6 @@ export function nodeIsConstantValue(kind: NodeKind): bool {
114
114
return false ;
115
115
}
116
116
117
- /** Checks if a node might be callable. */
118
- export function nodeIsCallable ( kind : NodeKind ) : bool {
119
- switch ( kind ) {
120
- case NodeKind . IDENTIFIER :
121
- case NodeKind . ASSERTION : // if kind=NONNULL
122
- case NodeKind . CALL :
123
- case NodeKind . ELEMENTACCESS :
124
- case NodeKind . PARENTHESIZED :
125
- case NodeKind . PROPERTYACCESS :
126
- case NodeKind . SUPER : return true ;
127
- }
128
- return false ;
129
- }
130
-
131
- /** Checks if a node might be callable with generic arguments. */
132
- export function nodeIsGenericCallable ( kind : NodeKind ) : bool {
133
- switch ( kind ) {
134
- case NodeKind . IDENTIFIER :
135
- case NodeKind . PROPERTYACCESS : return true ;
136
- }
137
- return false ;
138
- }
139
-
140
117
/** Base class of all nodes. */
141
118
export abstract class Node {
142
119
@@ -428,14 +405,14 @@ export abstract class Node {
428
405
}
429
406
430
407
static createNewExpression (
431
- expression : Expression ,
408
+ typeName : TypeName ,
432
409
typeArgs : TypeNode [ ] | null ,
433
410
args : Expression [ ] ,
434
411
range : Range
435
412
) : NewExpression {
436
413
var expr = new NewExpression ( ) ;
437
414
expr . range = range ;
438
- expr . expression = expression ;
415
+ expr . typeName = typeName ;
439
416
expr . typeArguments = typeArgs ;
440
417
expr . arguments = args ;
441
418
return expr ;
@@ -1489,8 +1466,35 @@ export class IntegerLiteralExpression extends LiteralExpression {
1489
1466
}
1490
1467
1491
1468
/** Represents a `new` expression. Like a call but with its own kind. */
1492
- export class NewExpression extends CallExpression {
1469
+ export class NewExpression extends Expression {
1493
1470
kind = NodeKind . NEW ;
1471
+
1472
+ /** Type being constructed. */
1473
+ typeName : TypeName ;
1474
+ /** Provided type arguments. */
1475
+ typeArguments : TypeNode [ ] | null ;
1476
+ /** Provided arguments. */
1477
+ arguments : Expression [ ] ;
1478
+
1479
+ /** Gets the type arguments range for reporting. */
1480
+ get typeArgumentsRange ( ) : Range {
1481
+ var typeArguments = this . typeArguments ;
1482
+ var numTypeArguments : i32 ;
1483
+ if ( typeArguments && ( numTypeArguments = typeArguments . length ) ) {
1484
+ return Range . join ( typeArguments [ 0 ] . range , typeArguments [ numTypeArguments - 1 ] . range ) ;
1485
+ }
1486
+ return this . typeName . range ;
1487
+ }
1488
+
1489
+ /** Gets the arguments range for reporting. */
1490
+ get argumentsRange ( ) : Range {
1491
+ var args = this . arguments ;
1492
+ var numArguments = args . length ;
1493
+ if ( numArguments ) {
1494
+ return Range . join ( args [ 0 ] . range , args [ numArguments - 1 ] . range ) ;
1495
+ }
1496
+ return this . typeName . range ;
1497
+ }
1494
1498
}
1495
1499
1496
1500
/** Represents a `null` expression. */
@@ -1639,12 +1643,10 @@ export class Source extends Node {
1639
1643
statements : Statement [ ] ;
1640
1644
/** Full source text. */
1641
1645
text : string ;
1642
- /** Tokenizer reference. */
1643
- tokenizer : Tokenizer | null = null ;
1644
1646
/** Source map index. */
1645
1647
debugInfoIndex : i32 = - 1 ;
1646
1648
/** Re-exported sources. */
1647
- exportPaths : Set < string > | null = null ;
1649
+ exportPaths : string [ ] | null = null ;
1648
1650
1649
1651
/** Constructs a new source node. */
1650
1652
constructor ( normalizedPath : string , text : string , kind : SourceKind ) {
0 commit comments