File tree Expand file tree Collapse file tree 6 files changed +45
-2
lines changed Expand file tree Collapse file tree 6 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -6553,6 +6553,9 @@ module ts {
6553
6553
6554
6554
function getReturnTypeFromBody(func: FunctionLikeDeclaration, contextualMapper?: TypeMapper): Type {
6555
6555
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
6556
+ if (!func.body) {
6557
+ return unknownType;
6558
+ }
6556
6559
if (func.body.kind !== SyntaxKind.Block) {
6557
6560
var type = checkExpressionCached(<Expression>func.body, contextualMapper);
6558
6561
}
Original file line number Diff line number Diff line change @@ -2461,8 +2461,11 @@ module ts {
2461
2461
function tryEmitConstantValue ( node : PropertyAccessExpression | ElementAccessExpression ) : boolean {
2462
2462
var constantValue = resolver . getConstantValue ( node ) ;
2463
2463
if ( constantValue !== undefined ) {
2464
- var propertyName = node . kind === SyntaxKind . PropertyAccessExpression ? declarationNameToString ( ( < PropertyAccessExpression > node ) . name ) : getTextOfNode ( ( < ElementAccessExpression > node ) . argumentExpression ) ;
2465
- write ( constantValue . toString ( ) + " /* " + propertyName + " */" ) ;
2464
+ write ( constantValue . toString ( ) ) ;
2465
+ if ( ! compilerOptions . removeComments ) {
2466
+ var propertyName : string = node . kind === SyntaxKind . PropertyAccessExpression ? declarationNameToString ( ( < PropertyAccessExpression > node ) . name ) : getTextOfNode ( ( < ElementAccessExpression > node ) . argumentExpression ) ;
2467
+ write ( " /* " + propertyName + " */" ) ;
2468
+ }
2466
2469
return true ;
2467
2470
}
2468
2471
return false ;
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ module m1 {
86
86
87
87
/// this is x
88
88
declare var x ;
89
+
90
+
91
+ /** const enum member value comment (generated by TS) */
92
+ const enum color { red, green, blue }
93
+ var shade : color = color . green ;
89
94
90
95
91
96
//// [commentsdoNotEmitComments.js]
@@ -129,6 +134,7 @@ var m1;
129
134
} ) ( ) ;
130
135
m1 . b = b ;
131
136
} ) ( m1 || ( m1 = { } ) ) ;
137
+ var shade = 1 ;
132
138
133
139
134
140
//// [commentsdoNotEmitComments.d.ts]
@@ -161,3 +167,9 @@ declare module m1 {
161
167
}
162
168
}
163
169
declare var x: any ;
170
+ declare const enum color {
171
+ red = 0 ,
172
+ green = 1 ,
173
+ blue = 2 ,
174
+ }
175
+ declare var shade: color ;
Original file line number Diff line number Diff line change @@ -151,3 +151,18 @@ module m1 {
151
151
declare var x;
152
152
>x : any
153
153
154
+
155
+ /** const enum member value comment (generated by TS) */
156
+ const enum color { red, green, blue }
157
+ >color : color
158
+ >red : color
159
+ >green : color
160
+ >blue : color
161
+
162
+ var shade: color = color.green;
163
+ >shade : color
164
+ >color : color
165
+ >color.green : color
166
+ >color : typeof color
167
+ >green : color
168
+
Original file line number Diff line number Diff line change @@ -88,3 +88,8 @@ module m1 {
88
88
89
89
/// this is x
90
90
declare var x ;
91
+
92
+
93
+ /** const enum member value comment (generated by TS) */
94
+ const enum color { red , green , blue }
95
+ var shade : color = color . green ;
Original file line number Diff line number Diff line change
1
+ /// <reference path='fourslash.ts'/>
2
+
3
+ //// var x: { f(): string } = { f( }
4
+
5
+ verify . numberOfErrorsInCurrentFile ( 1 ) ;
You can’t perform that action at this time.
0 commit comments