mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
make sure that enum values are computed before the emit
This commit is contained in:
@@ -10001,8 +10001,8 @@ module ts {
|
||||
if (symbol && (symbol.flags & SymbolFlags.EnumMember)) {
|
||||
var declaration = symbol.valueDeclaration;
|
||||
var constantValue: number;
|
||||
if (declaration.kind === SyntaxKind.EnumMember && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) {
|
||||
return constantValue;
|
||||
if (declaration.kind === SyntaxKind.EnumMember) {
|
||||
return getEnumMemberValue(<EnumMember>declaration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -548,6 +548,18 @@ module FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputForCurrentFile(expected: string): void {
|
||||
var emit = this.languageService.getEmitOutput(this.activeFile.fileName);
|
||||
if (emit.outputFiles.length !== 1) {
|
||||
throw new Error("Expected exactly one output from emit of " + this.activeFile.fileName);
|
||||
}
|
||||
this.taoInvalidReason = 'verifyGetEmitOutputForCurrentFile impossible';
|
||||
var actual = emit.outputFiles[0].text;
|
||||
if (actual !== expected) {
|
||||
this.raiseError("Expected emit output to be '" + expected + "', but got '" + actual + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
|
||||
this.scenarioActions.push('<ShowCompletionList />');
|
||||
this.scenarioActions.push('<VerifyCompletionContainsItem ItemName="' + symbol + '"/>');
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: a.ts
|
||||
////const enum TestEnum {
|
||||
//// Foo, Bar
|
||||
////}
|
||||
////var testFirstFile = TestEnum.Bar;
|
||||
|
||||
// @Filename: b.ts
|
||||
/////// <reference path="a.ts" />
|
||||
/////*1*/
|
||||
////var testInOtherFile = TestEnum.Bar;
|
||||
|
||||
goTo.marker("1");
|
||||
verify.verifyGetEmitOutputForCurrentFile(
|
||||
"/// <reference path=\"a.ts\" />\r\n\
|
||||
var testInOtherFile = 1 /* Bar */;\r\n"
|
||||
)
|
||||
@@ -264,6 +264,10 @@ module FourSlashInterface {
|
||||
FourSlash.currentTestState.verifyCurrentFileContent(text);
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputForCurrentFile(expected: string): void {
|
||||
FourSlash.currentTestState.verifyGetEmitOutputForCurrentFile(expected);
|
||||
}
|
||||
|
||||
public currentParameterHelpArgumentNameIs(name: string) {
|
||||
FourSlash.currentTestState.verifyCurrentParameterHelpName(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user