mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Merge branch 'transforms' into transforms-fixMoreSourceMaps
This commit is contained in:
commit
2ef748308a
@ -423,10 +423,10 @@ namespace ts {
|
||||
createVariableDeclarationList([
|
||||
createVariableDeclaration(
|
||||
generatedName,
|
||||
createRequireCall(node),
|
||||
/*location*/ node
|
||||
createRequireCall(node)
|
||||
)
|
||||
])
|
||||
]),
|
||||
/*location*/ node
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -523,10 +523,15 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function addExportImportAssignments(statements: Statement[], node: Node) {
|
||||
const names = reduceEachChild(node, collectExportMembers, []);
|
||||
for (const name of names) {
|
||||
addExportMemberAssignments(statements, name);
|
||||
function addExportImportAssignments(statements: Statement[], node: ImportEqualsDeclaration | ImportDeclaration) {
|
||||
if (isImportEqualsDeclaration(node)) {
|
||||
addExportMemberAssignments(statements, node.name);
|
||||
}
|
||||
else {
|
||||
const names = reduceEachChild(node, collectExportMembers, []);
|
||||
for (const name of names) {
|
||||
addExportMemberAssignments(statements, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -739,9 +744,6 @@ namespace ts {
|
||||
|
||||
addExportMemberAssignments(statements, classDecl.name);
|
||||
|
||||
if (statements.length > 1) {
|
||||
Debug.assert(!!classDecl.decorators, "Expression statements should only have an export member assignment when decorated.")
|
||||
}
|
||||
return statements;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2750,7 +2750,7 @@ namespace ts {
|
||||
*/
|
||||
function isNamedExternalModuleExport(node: Node) {
|
||||
return isExternalModuleExport(node)
|
||||
&& hasModifier(node, ModifierFlags.Default);
|
||||
&& !hasModifier(node, ModifierFlags.Default);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -190,8 +190,9 @@ namespace RWC {
|
||||
if (compilerResult.errors.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors);
|
||||
// Do not include the library in the baselines to avoid noise
|
||||
const baselineFiles = inputFiles.concat(otherFiles).filter(f => !Harness.isDefaultLibraryFile(f.unitName));
|
||||
return Harness.Compiler.getErrorBaseline(baselineFiles, compilerResult.errors);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
|
||||
36
tests/baselines/reference/commentsOnRequireStatement.js
Normal file
36
tests/baselines/reference/commentsOnRequireStatement.js
Normal file
@ -0,0 +1,36 @@
|
||||
//// [tests/cases/compiler/commentsOnRequireStatement.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
|
||||
export var subject = 10;
|
||||
|
||||
//// [1.ts]
|
||||
export var subject1 = 10;
|
||||
|
||||
//// [2.ts]
|
||||
/* blah0 */
|
||||
// blah
|
||||
// blah
|
||||
// blah
|
||||
export {subject} from './0';
|
||||
/* blah1 */
|
||||
export {subject1} from './1';
|
||||
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
exports.subject = 10;
|
||||
//// [1.js]
|
||||
"use strict";
|
||||
exports.subject1 = 10;
|
||||
//// [2.js]
|
||||
"use strict";
|
||||
/* blah0 */
|
||||
// blah
|
||||
// blah
|
||||
// blah
|
||||
var _0_1 = require("./0");
|
||||
exports.subject = _0_1.subject;
|
||||
/* blah1 */
|
||||
var _1_1 = require("./1");
|
||||
exports.subject1 = _1_1.subject1;
|
||||
21
tests/baselines/reference/commentsOnRequireStatement.symbols
Normal file
21
tests/baselines/reference/commentsOnRequireStatement.symbols
Normal file
@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
export var subject = 10;
|
||||
>subject : Symbol(subject, Decl(0.ts, 1, 10))
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
export var subject1 = 10;
|
||||
>subject1 : Symbol(subject1, Decl(1.ts, 0, 10))
|
||||
|
||||
=== tests/cases/compiler/2.ts ===
|
||||
/* blah0 */
|
||||
// blah
|
||||
// blah
|
||||
// blah
|
||||
export {subject} from './0';
|
||||
>subject : Symbol(subject, Decl(2.ts, 4, 8))
|
||||
|
||||
/* blah1 */
|
||||
export {subject1} from './1';
|
||||
>subject1 : Symbol(subject1, Decl(2.ts, 6, 8))
|
||||
|
||||
23
tests/baselines/reference/commentsOnRequireStatement.types
Normal file
23
tests/baselines/reference/commentsOnRequireStatement.types
Normal file
@ -0,0 +1,23 @@
|
||||
=== tests/cases/compiler/0.ts ===
|
||||
|
||||
export var subject = 10;
|
||||
>subject : number
|
||||
>10 : number
|
||||
|
||||
=== tests/cases/compiler/1.ts ===
|
||||
export var subject1 = 10;
|
||||
>subject1 : number
|
||||
>10 : number
|
||||
|
||||
=== tests/cases/compiler/2.ts ===
|
||||
/* blah0 */
|
||||
// blah
|
||||
// blah
|
||||
// blah
|
||||
export {subject} from './0';
|
||||
>subject : number
|
||||
|
||||
/* blah1 */
|
||||
export {subject1} from './1';
|
||||
>subject1 : number
|
||||
|
||||
56
tests/baselines/reference/decoratorOnClassConstructor2.js
Normal file
56
tests/baselines/reference/decoratorOnClassConstructor2.js
Normal file
@ -0,0 +1,56 @@
|
||||
//// [tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor2.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
|
||||
export class base { }
|
||||
export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { }
|
||||
|
||||
//// [2.ts]
|
||||
import {base} from "./0.ts"
|
||||
import {foo} from "./0.ts"
|
||||
export class C extends base{
|
||||
constructor(@foo prop: any) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
//// [0.js]
|
||||
"use strict";
|
||||
var base = (function () {
|
||||
function base() {
|
||||
}
|
||||
return base;
|
||||
}());
|
||||
exports.base = base;
|
||||
function foo(target, propertyKey, parameterIndex) { }
|
||||
exports.foo = foo;
|
||||
//// [2.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var _0_ts_1 = require("./0.ts");
|
||||
var _0_ts_2 = require("./0.ts");
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C(prop) {
|
||||
_super.call(this);
|
||||
}
|
||||
return C;
|
||||
}(_0_ts_1.base));
|
||||
exports.C = C;
|
||||
C = __decorate([
|
||||
__param(0, _0_ts_2.foo)
|
||||
], C);
|
||||
exports.C = C;
|
||||
@ -0,0 +1,31 @@
|
||||
=== tests/cases/conformance/decorators/class/constructor/0.ts ===
|
||||
|
||||
export class base { }
|
||||
>base : Symbol(base, Decl(0.ts, 0, 0))
|
||||
|
||||
export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { }
|
||||
>foo : Symbol(foo, Decl(0.ts, 1, 21))
|
||||
>target : Symbol(target, Decl(0.ts, 2, 20))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>propertyKey : Symbol(propertyKey, Decl(0.ts, 2, 35))
|
||||
>parameterIndex : Symbol(parameterIndex, Decl(0.ts, 2, 65))
|
||||
|
||||
=== tests/cases/conformance/decorators/class/constructor/2.ts ===
|
||||
import {base} from "./0.ts"
|
||||
>base : Symbol(base, Decl(2.ts, 0, 8))
|
||||
|
||||
import {foo} from "./0.ts"
|
||||
>foo : Symbol(foo, Decl(2.ts, 1, 8))
|
||||
|
||||
export class C extends base{
|
||||
>C : Symbol(C, Decl(2.ts, 1, 26))
|
||||
>base : Symbol(base, Decl(2.ts, 0, 8))
|
||||
|
||||
constructor(@foo prop: any) {
|
||||
>foo : Symbol(foo, Decl(2.ts, 1, 8))
|
||||
>prop : Symbol(prop, Decl(2.ts, 3, 16))
|
||||
|
||||
super();
|
||||
>super : Symbol(base, Decl(0.ts, 0, 0))
|
||||
}
|
||||
}
|
||||
32
tests/baselines/reference/decoratorOnClassConstructor2.types
Normal file
32
tests/baselines/reference/decoratorOnClassConstructor2.types
Normal file
@ -0,0 +1,32 @@
|
||||
=== tests/cases/conformance/decorators/class/constructor/0.ts ===
|
||||
|
||||
export class base { }
|
||||
>base : base
|
||||
|
||||
export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { }
|
||||
>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
|
||||
>target : Object
|
||||
>Object : Object
|
||||
>propertyKey : string | symbol
|
||||
>parameterIndex : number
|
||||
|
||||
=== tests/cases/conformance/decorators/class/constructor/2.ts ===
|
||||
import {base} from "./0.ts"
|
||||
>base : typeof base
|
||||
|
||||
import {foo} from "./0.ts"
|
||||
>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
|
||||
|
||||
export class C extends base{
|
||||
>C : C
|
||||
>base : base
|
||||
|
||||
constructor(@foo prop: any) {
|
||||
>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
|
||||
>prop : any
|
||||
|
||||
super();
|
||||
>super() : void
|
||||
>super : typeof base
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
//// [tests/cases/conformance/es6/modules/defaultExportInAwaitExpression01.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
||||
export default x;
|
||||
|
||||
//// [b.ts]
|
||||
import x from './a';
|
||||
|
||||
( async function() {
|
||||
const value = await x;
|
||||
}() );
|
||||
|
||||
|
||||
//// [a.js]
|
||||
(function (dependencies, factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(dependencies, factory);
|
||||
}
|
||||
})(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
const x = new Promise((resolve, reject) => { resolve({}); });
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = x;
|
||||
});
|
||||
//// [b.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
(function (dependencies, factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(dependencies, factory);
|
||||
}
|
||||
})(["require", "exports", "./a"], function (require, exports) {
|
||||
"use strict";
|
||||
const a_1 = require("./a");
|
||||
(function () {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const value = yield a_1.default;
|
||||
});
|
||||
}());
|
||||
});
|
||||
@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/es6/modules/a.ts ===
|
||||
const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
||||
>x : Symbol(x, Decl(a.ts, 0, 5))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
>resolve : Symbol(resolve, Decl(a.ts, 0, 24))
|
||||
>reject : Symbol(reject, Decl(a.ts, 0, 33))
|
||||
>resolve : Symbol(resolve, Decl(a.ts, 0, 24))
|
||||
|
||||
export default x;
|
||||
>x : Symbol(x, Decl(a.ts, 0, 5))
|
||||
|
||||
=== tests/cases/conformance/es6/modules/b.ts ===
|
||||
import x from './a';
|
||||
>x : Symbol(x, Decl(b.ts, 0, 6))
|
||||
|
||||
( async function() {
|
||||
const value = await x;
|
||||
>value : Symbol(value, Decl(b.ts, 3, 9))
|
||||
>x : Symbol(x, Decl(b.ts, 0, 6))
|
||||
|
||||
}() );
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
=== tests/cases/conformance/es6/modules/a.ts ===
|
||||
const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
||||
>x : Promise<{}>
|
||||
>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}>
|
||||
>Promise : PromiseConstructor
|
||||
>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>reject : (reason?: any) => void
|
||||
>resolve( {} ) : void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>{} : {}
|
||||
|
||||
export default x;
|
||||
>x : Promise<{}>
|
||||
|
||||
=== tests/cases/conformance/es6/modules/b.ts ===
|
||||
import x from './a';
|
||||
>x : Promise<{}>
|
||||
|
||||
( async function() {
|
||||
>( async function() { const value = await x;}() ) : Promise<void>
|
||||
>async function() { const value = await x;}() : Promise<void>
|
||||
>async function() { const value = await x;} : () => Promise<void>
|
||||
|
||||
const value = await x;
|
||||
>value : {}
|
||||
>await x : {}
|
||||
>x : Promise<{}>
|
||||
|
||||
}() );
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
//// [tests/cases/conformance/es6/modules/defaultExportInAwaitExpression02.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
||||
export default x;
|
||||
|
||||
//// [b.ts]
|
||||
import x from './a';
|
||||
|
||||
( async function() {
|
||||
const value = await x;
|
||||
}() );
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
const x = new Promise((resolve, reject) => { resolve({}); });
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = x;
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
const a_1 = require("./a");
|
||||
(function () {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const value = yield a_1.default;
|
||||
});
|
||||
}());
|
||||
@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/es6/modules/a.ts ===
|
||||
const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
||||
>x : Symbol(x, Decl(a.ts, 0, 5))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
>resolve : Symbol(resolve, Decl(a.ts, 0, 24))
|
||||
>reject : Symbol(reject, Decl(a.ts, 0, 33))
|
||||
>resolve : Symbol(resolve, Decl(a.ts, 0, 24))
|
||||
|
||||
export default x;
|
||||
>x : Symbol(x, Decl(a.ts, 0, 5))
|
||||
|
||||
=== tests/cases/conformance/es6/modules/b.ts ===
|
||||
import x from './a';
|
||||
>x : Symbol(x, Decl(b.ts, 0, 6))
|
||||
|
||||
( async function() {
|
||||
const value = await x;
|
||||
>value : Symbol(value, Decl(b.ts, 3, 9))
|
||||
>x : Symbol(x, Decl(b.ts, 0, 6))
|
||||
|
||||
}() );
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
=== tests/cases/conformance/es6/modules/a.ts ===
|
||||
const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
||||
>x : Promise<{}>
|
||||
>new Promise( ( resolve, reject ) => { resolve( {} ); } ) : Promise<{}>
|
||||
>Promise : PromiseConstructor
|
||||
>( resolve, reject ) => { resolve( {} ); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>reject : (reason?: any) => void
|
||||
>resolve( {} ) : void
|
||||
>resolve : (value?: {} | PromiseLike<{}>) => void
|
||||
>{} : {}
|
||||
|
||||
export default x;
|
||||
>x : Promise<{}>
|
||||
|
||||
=== tests/cases/conformance/es6/modules/b.ts ===
|
||||
import x from './a';
|
||||
>x : Promise<{}>
|
||||
|
||||
( async function() {
|
||||
>( async function() { const value = await x;}() ) : Promise<void>
|
||||
>async function() { const value = await x;}() : Promise<void>
|
||||
>async function() { const value = await x;} : () => Promise<void>
|
||||
|
||||
const value = await x;
|
||||
>value : {}
|
||||
>await x : {}
|
||||
>x : Promise<{}>
|
||||
|
||||
}() );
|
||||
|
||||
@ -43,7 +43,7 @@ export enum Utensils { // Shouldn't error
|
||||
//// [moduleDuplicateIdentifiers.js]
|
||||
"use strict";
|
||||
exports.Foo = 2;
|
||||
exports.Foo = 42;
|
||||
exports.Foo = 42; // Should error
|
||||
var FooBar;
|
||||
(function (FooBar) {
|
||||
FooBar.member1 = 2;
|
||||
@ -77,4 +77,3 @@ var Utensils = exports.Utensils;
|
||||
(function (Utensils) {
|
||||
Utensils[Utensils["Spork"] = 3] = "Spork";
|
||||
})(exports.Utensils || (exports.Utensils = {}));
|
||||
var Utensils = exports.Utensils;
|
||||
|
||||
@ -6,7 +6,6 @@ tests/cases/compiler/moduleElementsInWrongContext.ts(13,5): error TS1231: An exp
|
||||
tests/cases/compiler/moduleElementsInWrongContext.ts(17,5): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext.ts(18,5): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext.ts(19,5): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext.ts(19,14): error TS2305: Module '"ambient"' has no exported member 'baz'.
|
||||
tests/cases/compiler/moduleElementsInWrongContext.ts(20,5): error TS1231: An export assignment can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext.ts(21,5): error TS1184: Modifiers cannot appear here.
|
||||
tests/cases/compiler/moduleElementsInWrongContext.ts(22,5): error TS1184: Modifiers cannot appear here.
|
||||
@ -18,7 +17,7 @@ tests/cases/compiler/moduleElementsInWrongContext.ts(27,5): error TS1232: An imp
|
||||
tests/cases/compiler/moduleElementsInWrongContext.ts(28,5): error TS1232: An import declaration can only be used in a namespace or module.
|
||||
|
||||
|
||||
==== tests/cases/compiler/moduleElementsInWrongContext.ts (18 errors) ====
|
||||
==== tests/cases/compiler/moduleElementsInWrongContext.ts (17 errors) ====
|
||||
{
|
||||
module M { }
|
||||
~~~~~~
|
||||
@ -54,8 +53,6 @@ tests/cases/compiler/moduleElementsInWrongContext.ts(28,5): error TS1232: An imp
|
||||
export { baz as b } from "ambient";
|
||||
~~~~~~
|
||||
!!! error TS1233: An export declaration can only be used in a module.
|
||||
~~~
|
||||
!!! error TS2305: Module '"ambient"' has no exported member 'baz'.
|
||||
export default v;
|
||||
~~~~~~
|
||||
!!! error TS1231: An export assignment can only be used in a module.
|
||||
|
||||
@ -6,7 +6,6 @@ tests/cases/compiler/moduleElementsInWrongContext2.ts(13,5): error TS1231: An ex
|
||||
tests/cases/compiler/moduleElementsInWrongContext2.ts(17,5): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext2.ts(18,5): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext2.ts(19,5): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext2.ts(19,30): error TS2307: Cannot find module 'ambient'.
|
||||
tests/cases/compiler/moduleElementsInWrongContext2.ts(20,5): error TS1231: An export assignment can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext2.ts(21,5): error TS1184: Modifiers cannot appear here.
|
||||
tests/cases/compiler/moduleElementsInWrongContext2.ts(22,5): error TS1184: Modifiers cannot appear here.
|
||||
@ -18,7 +17,7 @@ tests/cases/compiler/moduleElementsInWrongContext2.ts(27,5): error TS1232: An im
|
||||
tests/cases/compiler/moduleElementsInWrongContext2.ts(28,5): error TS1232: An import declaration can only be used in a namespace or module.
|
||||
|
||||
|
||||
==== tests/cases/compiler/moduleElementsInWrongContext2.ts (18 errors) ====
|
||||
==== tests/cases/compiler/moduleElementsInWrongContext2.ts (17 errors) ====
|
||||
function blah () {
|
||||
module M { }
|
||||
~~~~~~
|
||||
@ -54,8 +53,6 @@ tests/cases/compiler/moduleElementsInWrongContext2.ts(28,5): error TS1232: An im
|
||||
export { baz as b } from "ambient";
|
||||
~~~~~~
|
||||
!!! error TS1233: An export declaration can only be used in a module.
|
||||
~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'ambient'.
|
||||
export default v;
|
||||
~~~~~~
|
||||
!!! error TS1231: An export assignment can only be used in a module.
|
||||
|
||||
@ -6,7 +6,6 @@ tests/cases/compiler/moduleElementsInWrongContext3.ts(14,9): error TS1231: An ex
|
||||
tests/cases/compiler/moduleElementsInWrongContext3.ts(18,9): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext3.ts(19,9): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext3.ts(20,9): error TS1233: An export declaration can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext3.ts(20,34): error TS2307: Cannot find module 'ambient'.
|
||||
tests/cases/compiler/moduleElementsInWrongContext3.ts(21,9): error TS1231: An export assignment can only be used in a module.
|
||||
tests/cases/compiler/moduleElementsInWrongContext3.ts(22,9): error TS1184: Modifiers cannot appear here.
|
||||
tests/cases/compiler/moduleElementsInWrongContext3.ts(23,9): error TS1184: Modifiers cannot appear here.
|
||||
@ -18,7 +17,7 @@ tests/cases/compiler/moduleElementsInWrongContext3.ts(28,9): error TS1232: An im
|
||||
tests/cases/compiler/moduleElementsInWrongContext3.ts(29,9): error TS1232: An import declaration can only be used in a namespace or module.
|
||||
|
||||
|
||||
==== tests/cases/compiler/moduleElementsInWrongContext3.ts (18 errors) ====
|
||||
==== tests/cases/compiler/moduleElementsInWrongContext3.ts (17 errors) ====
|
||||
module P {
|
||||
{
|
||||
module M { }
|
||||
@ -55,8 +54,6 @@ tests/cases/compiler/moduleElementsInWrongContext3.ts(29,9): error TS1232: An im
|
||||
export { baz as b } from "ambient";
|
||||
~~~~~~
|
||||
!!! error TS1233: An export declaration can only be used in a module.
|
||||
~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module 'ambient'.
|
||||
export default v;
|
||||
~~~~~~
|
||||
!!! error TS1231: An export assignment can only be used in a module.
|
||||
|
||||
@ -440,6 +440,8 @@ var m1;
|
||||
//var m1_im4_private_v4_private = m1_im4_private.f1();
|
||||
m1.m1_im1_public = m1_M1_public;
|
||||
m1.m1_im2_public = m1_M2_private;
|
||||
//export import m1_im3_public = require("m1_M3_public");
|
||||
//export import m1_im4_public = require("m1_M4_private");
|
||||
})(m1 = exports.m1 || (exports.m1 = {}));
|
||||
var m2;
|
||||
(function (m2) {
|
||||
@ -524,6 +526,8 @@ var m2;
|
||||
// Parse error to export module
|
||||
m2.m1_im1_public = m2_M1_public;
|
||||
m2.m1_im2_public = m2_M2_private;
|
||||
//export import m1_im3_public = require("m2_M3_public");
|
||||
//export import m1_im4_public = require("m2_M4_private");
|
||||
})(m2 || (m2 = {}));
|
||||
var glo_M1_public;
|
||||
(function (glo_M1_public) {
|
||||
@ -686,6 +690,7 @@ var m2;
|
||||
var m4;
|
||||
(function (m4) {
|
||||
var a = 10;
|
||||
//import m2 = require("use_glo_M1_public");
|
||||
})(m4 || (m4 = {}));
|
||||
})(m2 || (m2 = {}));
|
||||
var m3;
|
||||
@ -694,5 +699,6 @@ var m3;
|
||||
var m4;
|
||||
(function (m4) {
|
||||
var a = 10;
|
||||
//import m2 = require("use_glo_M1_public");
|
||||
})(m4 || (m4 = {}));
|
||||
})(m3 = exports.m3 || (exports.m3 = {}));
|
||||
|
||||
17
tests/cases/compiler/commentsOnRequireStatement.ts
Normal file
17
tests/cases/compiler/commentsOnRequireStatement.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
|
||||
// @Filename: 0.ts
|
||||
export var subject = 10;
|
||||
|
||||
// @Filename: 1.ts
|
||||
export var subject1 = 10;
|
||||
|
||||
// @Filename: 2.ts
|
||||
/* blah0 */
|
||||
// blah
|
||||
// blah
|
||||
// blah
|
||||
export {subject} from './0';
|
||||
/* blah1 */
|
||||
export {subject1} from './1';
|
||||
@ -0,0 +1,16 @@
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @experimentaldecorators: true
|
||||
|
||||
// @Filename: 0.ts
|
||||
export class base { }
|
||||
export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { }
|
||||
|
||||
// @Filename: 2.ts
|
||||
import {base} from "./0.ts"
|
||||
import {foo} from "./0.ts"
|
||||
export class C extends base{
|
||||
constructor(@foo prop: any) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
// @target: ES6
|
||||
// @module: umd
|
||||
// @filename: a.ts
|
||||
const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
||||
export default x;
|
||||
|
||||
// @filename: b.ts
|
||||
import x from './a';
|
||||
|
||||
( async function() {
|
||||
const value = await x;
|
||||
}() );
|
||||
@ -0,0 +1,12 @@
|
||||
// @target: ES6
|
||||
// @module: commonjs
|
||||
// @filename: a.ts
|
||||
const x = new Promise( ( resolve, reject ) => { resolve( {} ); } );
|
||||
export default x;
|
||||
|
||||
// @filename: b.ts
|
||||
import x from './a';
|
||||
|
||||
( async function() {
|
||||
const value = await x;
|
||||
}() );
|
||||
Loading…
x
Reference in New Issue
Block a user