mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-20 19:45:07 -06:00
Add es6 target
This commit is contained in:
parent
bdac6ca895
commit
873c1df74b
@ -102,10 +102,10 @@ module ts {
|
||||
{
|
||||
name: "target",
|
||||
shortName: "t",
|
||||
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5 },
|
||||
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_or_ES5,
|
||||
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5 , "es6": ScriptTarget.ES6 },
|
||||
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
paramType: Diagnostics.VERSION,
|
||||
error: Diagnostics.Argument_for_target_option_must_be_es3_or_es5
|
||||
error: Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
|
||||
@ -357,7 +357,7 @@ module ts {
|
||||
Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." },
|
||||
Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_or_ES5: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), or 'ES5'" },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
|
||||
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." },
|
||||
@ -379,7 +379,7 @@ module ts {
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." },
|
||||
Argument_for_target_option_must_be_es3_or_es5: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3' or 'es5'." },
|
||||
Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." },
|
||||
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
|
||||
Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
|
||||
Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
|
||||
|
||||
@ -1424,7 +1424,7 @@
|
||||
"category": "Message",
|
||||
"code": 6009
|
||||
},
|
||||
"Specify ECMAScript target version: 'ES3' (default), or 'ES5'": {
|
||||
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)": {
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
},
|
||||
@ -1512,7 +1512,7 @@
|
||||
"category": "Error",
|
||||
"code": 6046
|
||||
},
|
||||
"Argument for '--target' option must be 'es3' or 'es5'.": {
|
||||
"Argument for '--target' option must be 'es3', 'es5', or 'es6'.": {
|
||||
"category": "Error",
|
||||
"code": 6047
|
||||
},
|
||||
|
||||
@ -1062,6 +1062,8 @@ module ts {
|
||||
export enum ScriptTarget {
|
||||
ES3,
|
||||
ES5,
|
||||
ES6,
|
||||
Latest = ES6,
|
||||
}
|
||||
|
||||
export interface ParsedCommandLine {
|
||||
|
||||
@ -2139,7 +2139,7 @@ module FourSlash {
|
||||
var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFilename, content: undefined },
|
||||
{ unitName: fileName, content: content }],
|
||||
(fn, contents) => result = contents,
|
||||
ts.ScriptTarget.ES5,
|
||||
ts.ScriptTarget.Latest,
|
||||
sys.useCaseSensitiveFileNames);
|
||||
var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js" }, host);
|
||||
var checker = ts.createTypeChecker(program, /*fullTypeCheckMode*/ true);
|
||||
|
||||
@ -532,7 +532,7 @@ module Harness {
|
||||
}
|
||||
|
||||
export var defaultLibFileName = 'lib.d.ts';
|
||||
export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.ES5, /*version:*/ "0");
|
||||
export var defaultLibSourceFile = ts.createSourceFile(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*version:*/ "0");
|
||||
|
||||
// Cache these between executions so we don't have to re-parse them for every test
|
||||
export var fourslashFilename = 'fourslash.ts';
|
||||
@ -685,6 +685,8 @@ module Harness {
|
||||
options.target = ts.ScriptTarget.ES3;
|
||||
} else if (setting.value.toLowerCase() === 'es5') {
|
||||
options.target = ts.ScriptTarget.ES5;
|
||||
} else if (setting.value.toLowerCase() === 'es6') {
|
||||
options.target = ts.ScriptTarget.ES6;
|
||||
} else {
|
||||
throw new Error('Unknown compile target ' + setting.value);
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ module Harness.LanguageService {
|
||||
|
||||
/** Parse file given its source text */
|
||||
public parseSourceText(fileName: string, sourceText: TypeScript.IScriptSnapshot): TypeScript.SourceUnitSyntax {
|
||||
return TypeScript.Parser.parse(fileName, TypeScript.SimpleText.fromScriptSnapshot(sourceText), ts.ScriptTarget.ES5, TypeScript.isDTSFile(fileName)).sourceUnit();
|
||||
return TypeScript.Parser.parse(fileName, TypeScript.SimpleText.fromScriptSnapshot(sourceText), ts.ScriptTarget.Latest, TypeScript.isDTSFile(fileName)).sourceUnit();
|
||||
}
|
||||
|
||||
/** Parse a file on disk given its fileName */
|
||||
|
||||
@ -184,7 +184,7 @@ module TypeScript {
|
||||
|
||||
export function preProcessFile(fileName: string, sourceText: IScriptSnapshot, readImportFiles = true): IPreProcessedFileInfo {
|
||||
var text = SimpleText.fromScriptSnapshot(sourceText);
|
||||
var scanner = Scanner.createScanner(ts.ScriptTarget.ES5, text, reportDiagnostic);
|
||||
var scanner = Scanner.createScanner(ts.ScriptTarget.Latest, text, reportDiagnostic);
|
||||
|
||||
var firstToken = scanner.scan(/*allowRegularExpression:*/ false);
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ module ts {
|
||||
update(scriptSnapshot: TypeScript.IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TypeScript.TextChangeRange): SourceFile;
|
||||
}
|
||||
|
||||
var scanner: Scanner = createScanner(ScriptTarget.ES5, /*skipTrivia*/ true);
|
||||
var scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
|
||||
|
||||
var emptyArray: any[] = [];
|
||||
|
||||
@ -1456,9 +1456,9 @@ module ts {
|
||||
}
|
||||
|
||||
export function getDefaultCompilerOptions(): CompilerOptions {
|
||||
// Set "ES5" target by default for language service
|
||||
// Set "ScriptTarget.Latest" target by default for language service
|
||||
return {
|
||||
target: ScriptTarget.ES5,
|
||||
target: ScriptTarget.Latest,
|
||||
module: ModuleKind.None,
|
||||
};
|
||||
}
|
||||
@ -3794,8 +3794,8 @@ module ts {
|
||||
// before and after it have to be a non-identifier char).
|
||||
var endPosition = position + symbolNameLength;
|
||||
|
||||
if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.ES5)) &&
|
||||
(endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.ES5))) {
|
||||
if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.Latest)) &&
|
||||
(endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.Latest))) {
|
||||
// Found a real match. Keep searching.
|
||||
positions.push(position);
|
||||
}
|
||||
@ -5217,7 +5217,7 @@ module ts {
|
||||
|
||||
/// Classifier
|
||||
export function createClassifier(host: Logger): Classifier {
|
||||
var scanner = createScanner(ScriptTarget.ES5, /*skipTrivia*/ false);
|
||||
var scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
|
||||
|
||||
/// We do not have a full parser support to know when we should parse a regex or not
|
||||
/// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where
|
||||
|
||||
@ -174,6 +174,7 @@ module ts {
|
||||
export enum LanguageVersion {
|
||||
EcmaScript3 = 0,
|
||||
EcmaScript5 = 1,
|
||||
EcmaScript6 = 2,
|
||||
}
|
||||
|
||||
export enum ModuleGenTarget {
|
||||
@ -213,6 +214,7 @@ module ts {
|
||||
switch (languageVersion) {
|
||||
case LanguageVersion.EcmaScript3: return ScriptTarget.ES3
|
||||
case LanguageVersion.EcmaScript5: return ScriptTarget.ES5;
|
||||
case LanguageVersion.EcmaScript6: return ScriptTarget.ES6;
|
||||
default: throw Error("unsupported LanguageVersion value: " + languageVersion);
|
||||
}
|
||||
}
|
||||
@ -234,6 +236,7 @@ module ts {
|
||||
switch (scriptTarget) {
|
||||
case ScriptTarget.ES3: return LanguageVersion.EcmaScript3;
|
||||
case ScriptTarget.ES5: return LanguageVersion.EcmaScript5;
|
||||
case ScriptTarget.ES6: return LanguageVersion.EcmaScript6;
|
||||
default: throw Error("unsupported ScriptTarget value: " + scriptTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ module TypeScript.Scanner {
|
||||
var lastTokenInfo = { leadingTriviaWidth: -1, width: -1 };
|
||||
var lastTokenInfoTokenID: number = -1;
|
||||
|
||||
var triviaScanner = createScannerInternal(ts.ScriptTarget.ES5, SimpleText.fromString(""), () => { });
|
||||
var triviaScanner = createScannerInternal(ts.ScriptTarget.Latest, SimpleText.fromString(""), () => { });
|
||||
|
||||
interface IScannerToken extends ISyntaxToken {
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ module TypeScript {
|
||||
if (languageVersion === ts.ScriptTarget.ES3) {
|
||||
return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierStart);
|
||||
}
|
||||
else if (languageVersion === ts.ScriptTarget.ES5) {
|
||||
else if (languageVersion >= ts.ScriptTarget.ES5) {
|
||||
return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierStart);
|
||||
}
|
||||
else {
|
||||
@ -96,7 +96,7 @@ module TypeScript {
|
||||
if (languageVersion === ts.ScriptTarget.ES3) {
|
||||
return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES3IdentifierPart);
|
||||
}
|
||||
else if (languageVersion === ts.ScriptTarget.ES5) {
|
||||
else if (languageVersion >= ts.ScriptTarget.ES5) {
|
||||
return Unicode.lookupInUnicodeMap(code, Unicode.unicodeES5IdentifierPart);
|
||||
}
|
||||
else {
|
||||
|
||||
31
tests/baselines/reference/es6-amd.js
Normal file
31
tests/baselines/reference/es6-amd.js
Normal file
@ -0,0 +1,31 @@
|
||||
//// [es6-amd.ts]
|
||||
|
||||
class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//// [es6-amd.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.B = function () {
|
||||
return 42;
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
//# sourceMappingURL=es6-amd.js.map
|
||||
|
||||
//// [es6-amd.d.ts]
|
||||
declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
2
tests/baselines/reference/es6-amd.js.map
Normal file
2
tests/baselines/reference/es6-amd.js.map
Normal file
@ -0,0 +1,2 @@
|
||||
//// [es6-amd.js.map]
|
||||
{"version":3,"file":"es6-amd.js","sourceRoot":"","sources":["es6-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA,IAAM,CAAC;IAEHA,SAFEA,CAACA;IAKHC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
|
||||
128
tests/baselines/reference/es6-amd.sourcemap.txt
Normal file
128
tests/baselines/reference/es6-amd.sourcemap.txt
Normal file
@ -0,0 +1,128 @@
|
||||
===================================================================
|
||||
JsFile: es6-amd.js
|
||||
mapUrl: es6-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es6-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es6-amd.js
|
||||
sourceFile:es6-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var A = (function () {
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >class
|
||||
3 > A
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(2, 7) + SourceIndex(0)
|
||||
3 >Emitted(1, 6) Source(2, 8) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^
|
||||
3 > ^
|
||||
1->
|
||||
>{
|
||||
>
|
||||
2 >
|
||||
3 > A
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
2 >Emitted(2, 14) Source(2, 7) + SourceIndex(0) name (A)
|
||||
3 >Emitted(2, 15) Source(2, 8) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>{
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>})();
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >}
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=es6-amd.js.map
|
||||
16
tests/baselines/reference/es6-amd.types
Normal file
16
tests/baselines/reference/es6-amd.types
Normal file
@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/es6-amd.ts ===
|
||||
|
||||
class A
|
||||
>A : A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : () => number
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
31
tests/baselines/reference/es6-declaration-amd.js
Normal file
31
tests/baselines/reference/es6-declaration-amd.js
Normal file
@ -0,0 +1,31 @@
|
||||
//// [es6-declaration-amd.ts]
|
||||
|
||||
class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//// [es6-declaration-amd.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.B = function () {
|
||||
return 42;
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
//# sourceMappingURL=es6-declaration-amd.js.map
|
||||
|
||||
//// [es6-declaration-amd.d.ts]
|
||||
declare class A {
|
||||
constructor();
|
||||
B(): number;
|
||||
}
|
||||
2
tests/baselines/reference/es6-declaration-amd.js.map
Normal file
2
tests/baselines/reference/es6-declaration-amd.js.map
Normal file
@ -0,0 +1,2 @@
|
||||
//// [es6-declaration-amd.js.map]
|
||||
{"version":3,"file":"es6-declaration-amd.js","sourceRoot":"","sources":["es6-declaration-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA,IAAM,CAAC;IAEHA,SAFEA,CAACA;IAKHC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
|
||||
128
tests/baselines/reference/es6-declaration-amd.sourcemap.txt
Normal file
128
tests/baselines/reference/es6-declaration-amd.sourcemap.txt
Normal file
@ -0,0 +1,128 @@
|
||||
===================================================================
|
||||
JsFile: es6-declaration-amd.js
|
||||
mapUrl: es6-declaration-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es6-declaration-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es6-declaration-amd.js
|
||||
sourceFile:es6-declaration-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var A = (function () {
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >class
|
||||
3 > A
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(2, 7) + SourceIndex(0)
|
||||
3 >Emitted(1, 6) Source(2, 8) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^
|
||||
3 > ^
|
||||
1->
|
||||
>{
|
||||
>
|
||||
2 >
|
||||
3 > A
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
2 >Emitted(2, 14) Source(2, 7) + SourceIndex(0) name (A)
|
||||
3 >Emitted(2, 15) Source(2, 8) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>{
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>})();
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >}
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=es6-declaration-amd.js.map
|
||||
16
tests/baselines/reference/es6-declaration-amd.types
Normal file
16
tests/baselines/reference/es6-declaration-amd.types
Normal file
@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/es6-declaration-amd.ts ===
|
||||
|
||||
class A
|
||||
>A : A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : () => number
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
25
tests/baselines/reference/es6-sourcemap-amd.js
Normal file
25
tests/baselines/reference/es6-sourcemap-amd.js
Normal file
@ -0,0 +1,25 @@
|
||||
//// [es6-sourcemap-amd.ts]
|
||||
|
||||
class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
//// [es6-sourcemap-amd.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.B = function () {
|
||||
return 42;
|
||||
};
|
||||
return A;
|
||||
})();
|
||||
//# sourceMappingURL=es6-sourcemap-amd.js.map
|
||||
2
tests/baselines/reference/es6-sourcemap-amd.js.map
Normal file
2
tests/baselines/reference/es6-sourcemap-amd.js.map
Normal file
@ -0,0 +1,2 @@
|
||||
//// [es6-sourcemap-amd.js.map]
|
||||
{"version":3,"file":"es6-sourcemap-amd.js","sourceRoot":"","sources":["es6-sourcemap-amd.ts"],"names":["A","A.constructor","A.B"],"mappings":"AACA,IAAM,CAAC;IAEHA,SAFEA,CAACA;IAKHC,CAACA;IAEMD,aAACA,GAARA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IACLF,QAACA;AAADA,CAACA,AAXD,IAWC"}
|
||||
128
tests/baselines/reference/es6-sourcemap-amd.sourcemap.txt
Normal file
128
tests/baselines/reference/es6-sourcemap-amd.sourcemap.txt
Normal file
@ -0,0 +1,128 @@
|
||||
===================================================================
|
||||
JsFile: es6-sourcemap-amd.js
|
||||
mapUrl: es6-sourcemap-amd.js.map
|
||||
sourceRoot:
|
||||
sources: es6-sourcemap-amd.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:tests/cases/compiler/es6-sourcemap-amd.js
|
||||
sourceFile:es6-sourcemap-amd.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var A = (function () {
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 >class
|
||||
3 > A
|
||||
1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(2, 7) + SourceIndex(0)
|
||||
3 >Emitted(1, 6) Source(2, 8) + SourceIndex(0)
|
||||
---
|
||||
>>> function A() {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^
|
||||
3 > ^
|
||||
1->
|
||||
>{
|
||||
>
|
||||
2 >
|
||||
3 > A
|
||||
1->Emitted(2, 5) Source(4, 5) + SourceIndex(0) name (A)
|
||||
2 >Emitted(2, 14) Source(2, 7) + SourceIndex(0) name (A)
|
||||
3 >Emitted(2, 15) Source(2, 8) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> }
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>{
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(3, 5) Source(7, 5) + SourceIndex(0) name (A.constructor)
|
||||
2 >Emitted(3, 6) Source(7, 6) + SourceIndex(0) name (A.constructor)
|
||||
---
|
||||
>>> A.prototype.B = function () {
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^
|
||||
3 > ^^^
|
||||
1->
|
||||
>
|
||||
> public
|
||||
2 > B
|
||||
3 >
|
||||
1->Emitted(4, 5) Source(9, 12) + SourceIndex(0) name (A)
|
||||
2 >Emitted(4, 18) Source(9, 13) + SourceIndex(0) name (A)
|
||||
3 >Emitted(4, 21) Source(9, 5) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>> return 42;
|
||||
1 >^^^^^^^^
|
||||
2 > ^^^^^^
|
||||
3 > ^
|
||||
4 > ^^
|
||||
5 > ^
|
||||
1 >public B()
|
||||
> {
|
||||
>
|
||||
2 > return
|
||||
3 >
|
||||
4 > 42
|
||||
5 > ;
|
||||
1 >Emitted(5, 9) Source(11, 9) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(5, 15) Source(11, 15) + SourceIndex(0) name (A.B)
|
||||
3 >Emitted(5, 16) Source(11, 16) + SourceIndex(0) name (A.B)
|
||||
4 >Emitted(5, 18) Source(11, 18) + SourceIndex(0) name (A.B)
|
||||
5 >Emitted(5, 19) Source(11, 19) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> };
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(6, 5) Source(12, 5) + SourceIndex(0) name (A.B)
|
||||
2 >Emitted(6, 6) Source(12, 6) + SourceIndex(0) name (A.B)
|
||||
---
|
||||
>>> return A;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^
|
||||
1->
|
||||
>
|
||||
2 > }
|
||||
1->Emitted(7, 5) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(7, 13) Source(13, 2) + SourceIndex(0) name (A)
|
||||
---
|
||||
>>>})();
|
||||
1 >
|
||||
2 >^
|
||||
3 >
|
||||
4 > ^^^^
|
||||
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >}
|
||||
3 >
|
||||
4 > class A
|
||||
> {
|
||||
> constructor ()
|
||||
> {
|
||||
>
|
||||
> }
|
||||
>
|
||||
> public B()
|
||||
> {
|
||||
> return 42;
|
||||
> }
|
||||
> }
|
||||
1 >Emitted(8, 1) Source(13, 1) + SourceIndex(0) name (A)
|
||||
2 >Emitted(8, 2) Source(13, 2) + SourceIndex(0) name (A)
|
||||
3 >Emitted(8, 2) Source(2, 1) + SourceIndex(0)
|
||||
4 >Emitted(8, 6) Source(13, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=es6-sourcemap-amd.js.map
|
||||
16
tests/baselines/reference/es6-sourcemap-amd.types
Normal file
16
tests/baselines/reference/es6-sourcemap-amd.types
Normal file
@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/es6-sourcemap-amd.ts ===
|
||||
|
||||
class A
|
||||
>A : A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : () => number
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
17
tests/cases/compiler/es6-amd.ts
Normal file
17
tests/cases/compiler/es6-amd.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// @target: ES6
|
||||
// @sourcemap: false
|
||||
// @declaration: false
|
||||
// @module: amd
|
||||
|
||||
class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
17
tests/cases/compiler/es6-declaration-amd.ts
Normal file
17
tests/cases/compiler/es6-declaration-amd.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// @target: ES6
|
||||
// @sourcemap: false
|
||||
// @declaration: true
|
||||
// @module: amd
|
||||
|
||||
class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
16
tests/cases/compiler/es6-sourcemap-amd.ts
Normal file
16
tests/cases/compiler/es6-sourcemap-amd.ts
Normal file
@ -0,0 +1,16 @@
|
||||
// @target: ES6
|
||||
// @sourcemap: true
|
||||
// @module: amd
|
||||
|
||||
class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user