@@ -864,6 +864,7 @@ export abstract class Node {
864
864
body : Statement | null ,
865
865
decorators : DecoratorNode [ ] | null ,
866
866
flags : CommonFlags ,
867
+ arrowKind : ArrowKind ,
867
868
range : Range
868
869
) : FunctionDeclaration {
869
870
var stmt = new FunctionDeclaration ( ) ;
@@ -874,6 +875,7 @@ export abstract class Node {
874
875
stmt . signature = signature ;
875
876
stmt . body = body ;
876
877
stmt . decorators = decorators ;
878
+ stmt . arrowKind = arrowKind ;
877
879
return stmt ;
878
880
}
879
881
@@ -1773,6 +1775,16 @@ export class ForStatement extends Statement {
1773
1775
statement : Statement ;
1774
1776
}
1775
1777
1778
+ /** Indicates the kind of an array function. */
1779
+ export const enum ArrowKind {
1780
+ /** Not an arrow function. */
1781
+ NONE ,
1782
+ /** Parenthesized parameter list. */
1783
+ ARROW_PARENTHESIZED ,
1784
+ /** Single parameter without parenthesis. */
1785
+ ARROW_SINGLE
1786
+ }
1787
+
1776
1788
/** Represents a `function` declaration. */
1777
1789
export class FunctionDeclaration extends DeclarationStatement {
1778
1790
kind = NodeKind . FUNCTIONDECLARATION ;
@@ -1783,6 +1795,8 @@ export class FunctionDeclaration extends DeclarationStatement {
1783
1795
signature : SignatureNode ;
1784
1796
/** Body statement. Usually a block. */
1785
1797
body : Statement | null ;
1798
+ /** Arrow function kind, if applicable. */
1799
+ arrowKind : ArrowKind ;
1786
1800
1787
1801
get isGeneric ( ) : bool {
1788
1802
var typeParameters = this . typeParameters ;
@@ -1792,7 +1806,14 @@ export class FunctionDeclaration extends DeclarationStatement {
1792
1806
/** Clones this function declaration. */
1793
1807
clone ( ) : FunctionDeclaration {
1794
1808
return Node . createFunctionDeclaration (
1795
- this . name , this . typeParameters , this . signature , this . body , this . decorators , this . flags , this . range
1809
+ this . name ,
1810
+ this . typeParameters ,
1811
+ this . signature ,
1812
+ this . body ,
1813
+ this . decorators ,
1814
+ this . flags ,
1815
+ this . arrowKind ,
1816
+ this . range
1796
1817
) ;
1797
1818
}
1798
1819
}
@@ -1960,3 +1981,12 @@ export function mangleInternalPath(path: string): string {
1960
1981
if ( path . endsWith ( ".ts" ) ) path = path . substring ( 0 , path . length - 3 ) ;
1961
1982
return path ;
1962
1983
}
1984
+
1985
+ /** Tests if the specified type node represents an omitted type. */
1986
+ export function isTypeOmitted ( type : CommonTypeNode ) : bool {
1987
+ if ( type . kind == NodeKind . TYPE ) {
1988
+ let name = ( < TypeNode > type ) . name ;
1989
+ return ! ( name . next || name . identifier . text . length ) ;
1990
+ }
1991
+ return false ;
1992
+ }
0 commit comments