Merge branch 'master' into LSAPICleanup

This commit is contained in:
Mohamed Hegazy 2015-02-02 17:14:08 -08:00
commit 277235539a
6 changed files with 45 additions and 2 deletions

View File

@ -6553,6 +6553,9 @@ module ts {
function getReturnTypeFromBody(func: FunctionLikeDeclaration, contextualMapper?: TypeMapper): Type {
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
if (!func.body) {
return unknownType;
}
if (func.body.kind !== SyntaxKind.Block) {
var type = checkExpressionCached(<Expression>func.body, contextualMapper);
}

View File

@ -2461,8 +2461,11 @@ module ts {
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
var constantValue = resolver.getConstantValue(node);
if (constantValue !== undefined) {
var propertyName = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((<PropertyAccessExpression>node).name) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
write(constantValue.toString() + " /* " + propertyName + " */");
write(constantValue.toString());
if (!compilerOptions.removeComments) {
var propertyName: string = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((<PropertyAccessExpression>node).name) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
write(" /* " + propertyName + " */");
}
return true;
}
return false;

View File

@ -86,6 +86,11 @@ module m1 {
/// this is x
declare var x;
/** const enum member value comment (generated by TS) */
const enum color { red, green, blue }
var shade: color = color.green;
//// [commentsdoNotEmitComments.js]
@ -129,6 +134,7 @@ var m1;
})();
m1.b = b;
})(m1 || (m1 = {}));
var shade = 1;
//// [commentsdoNotEmitComments.d.ts]
@ -161,3 +167,9 @@ declare module m1 {
}
}
declare var x: any;
declare const enum color {
red = 0,
green = 1,
blue = 2,
}
declare var shade: color;

View File

@ -151,3 +151,18 @@ module m1 {
declare var x;
>x : any
/** const enum member value comment (generated by TS) */
const enum color { red, green, blue }
>color : color
>red : color
>green : color
>blue : color
var shade: color = color.green;
>shade : color
>color : color
>color.green : color
>color : typeof color
>green : color

View File

@ -88,3 +88,8 @@ module m1 {
/// this is x
declare var x;
/** const enum member value comment (generated by TS) */
const enum color { red, green, blue }
var shade: color = color.green;

View File

@ -0,0 +1,5 @@
/// <reference path='fourslash.ts'/>
//// var x: { f(): string } = { f( }
verify.numberOfErrorsInCurrentFile(1);