Skip to content

Commit beb72f4

Browse files
author
Kanchalai Tanglertsampan
committed
Merge branch 'master' into transforms
# Conflicts: # Jakefile.js # src/compiler/emitter.ts # src/compiler/program.ts # src/compiler/types.ts # src/harness/harness.ts # src/services/services.ts # tests/baselines/reference/disallowAsyncModifierInES5.js # tests/baselines/reference/es5andes6module.js # tests/baselines/reference/es6ExportClauseWithAssignmentInEs5.js # tests/baselines/reference/es6modulekindWithES5Target.js # tests/baselines/reference/es6modulekindWithES5Target11.js # tests/baselines/reference/es6modulekindWithES5Target2.js # tests/baselines/reference/es6modulekindWithES5Target3.js # tests/baselines/reference/es6modulekindWithES5Target6.js # tests/cases/unittests/transpile.ts # tests/cases/unittests/tsserverProjectSystem.ts
2 parents 171ab06 + 7890fd5 commit beb72f4

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

src/harness/harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1789,4 +1789,4 @@ namespace Harness {
17891789
}
17901790

17911791
if (Error) (<any>Error).stackTraceLimit = 1;
1792-
}
1792+
}

src/services/services.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,17 +1951,11 @@ namespace ts {
19511951

19521952
let commandLineOptionsStringToEnum: CommandLineOptionOfCustomType[];
19531953

1954-
/**
1955-
* Convert an option's string name of enum-value in compiler-options, "options", into its corresponding enum value if possible.
1956-
* This is necessary because JS users may pass in string values for enum compiler options (e.g. ModuleKind).
1957-
*
1958-
* @param options a compiler-options used in transpilation which can contain string value to specify instead of enum values
1959-
* @param diagnostics a list of Diagnostic which occur during conversion (e.g invalid option's value)
1960-
*/
1961-
function ConvertStringForEnumNameInCompilerOptionsToEnumValue(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions {
1954+
/** JS users may pass in string values for enum compiler options (such as ModuleKind), so convert. */
1955+
function fixupCompilerOptions(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions {
19621956
// Lazily create this value to fix module loading errors.
19631957
commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || <CommandLineOptionOfCustomType[]>filter(optionDeclarations, o =>
1964-
typeof o.type === "object" && !forEachValue(<Map<number | string>> o.type, v => typeof v !== "number"));
1958+
typeof o.type === "object" && !forEachValue(<Map<any>> o.type, v => typeof v !== "number"));
19651959

19661960
options = clone(options);
19671961

@@ -1999,7 +1993,7 @@ namespace ts {
19991993
export function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput {
20001994
const diagnostics: Diagnostic[] = [];
20011995

2002-
const options: CompilerOptions = transpileOptions.compilerOptions ? ConvertStringForEnumNameInCompilerOptionsToEnumValue(transpileOptions.compilerOptions, diagnostics) : getDefaultCompilerOptions();
1996+
const options: CompilerOptions = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : getDefaultCompilerOptions();
20031997

20041998
options.isolatedModules = true;
20051999

tests/baselines/reference/disallowAsyncModifierInES5.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//// [disallowAsyncModifierInES5.ts]
2-
3-
async function foo() { return 42; } // ERROR: Async functions are only available in ES6+
4-
let bar = async function () { return 42; } // OK, but should be an error
2+
3+
async function foo() { return 42; } // ERROR: Async functions are only available in ES6+
4+
let bar = async function () { return 42; } // OK, but should be an error
55
let baz = async () => 42; // OK, but should be an error
66

77
//// [disallowAsyncModifierInES5.js]
@@ -20,4 +20,4 @@ function foo() {
2020
var bar = function () {
2121
return __awaiter(this, void 0, void 0, function* () { return 42; });
2222
}; // OK, but should be an error
23-
var baz = function () { return __awaiter(_this, void 0, void 0, function* () { return 42; }); }; // OK, but should be an error
23+
var baz = function () { return __awaiter(_this, void 0, void 0, function* () { return 42; }); }; // OK, but should be an error

0 commit comments

Comments
 (0)