-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4179 from Microsoft/exportDeclarationsInSystem
emit export declarations for system modules as a part of 'execute' me…
- Loading branch information
Showing
18 changed files
with
605 additions
and
176 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
tests/cases/compiler/systemModule14.ts(6,17): error TS2307: Cannot find module 'foo'. | ||
|
||
|
||
==== tests/cases/compiler/systemModule14.ts (1 errors) ==== | ||
|
||
function foo() { | ||
return a; | ||
} | ||
|
||
import {a} from "foo"; | ||
~~~~~ | ||
!!! error TS2307: Cannot find module 'foo'. | ||
export {foo} | ||
|
||
var x = 1; | ||
export {foo as b} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//// [systemModule14.ts] | ||
|
||
function foo() { | ||
return a; | ||
} | ||
|
||
import {a} from "foo"; | ||
export {foo} | ||
|
||
var x = 1; | ||
export {foo as b} | ||
|
||
//// [systemModule14.js] | ||
System.register(["foo"], function(exports_1) { | ||
var foo_1; | ||
var x; | ||
function foo() { | ||
return foo_1.a; | ||
} | ||
return { | ||
setters:[ | ||
function (foo_1_1) { | ||
foo_1 = foo_1_1; | ||
}], | ||
execute: function() { | ||
exports_1("foo", foo); | ||
x = 1; | ||
exports_1("b", foo); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
//// [tests/cases/compiler/systemModule15.ts] //// | ||
|
||
//// [file1.ts] | ||
|
||
|
||
import * as moduleB from "./file2" | ||
|
||
declare function use(v: any): void; | ||
|
||
use(moduleB.value); | ||
use(moduleB.moduleC); | ||
use(moduleB.moduleCStar); | ||
|
||
//// [file2.ts] | ||
|
||
import * as moduleCStar from "./file3" | ||
import {value2} from "./file4" | ||
import moduleC from "./file3" | ||
import {value} from "./file3" | ||
|
||
export { | ||
moduleCStar, | ||
moduleC, | ||
value | ||
} | ||
|
||
//// [file3.ts] | ||
|
||
export var value = "youpi"; | ||
export default value; | ||
|
||
//// [file4.ts] | ||
|
||
export var value2 = "v"; | ||
|
||
//// [file3.js] | ||
System.register([], function(exports_1) { | ||
var value; | ||
return { | ||
setters:[], | ||
execute: function() { | ||
exports_1("value", value = "youpi"); | ||
exports_1("default",value); | ||
} | ||
} | ||
}); | ||
//// [file4.js] | ||
System.register([], function(exports_1) { | ||
var value2; | ||
return { | ||
setters:[], | ||
execute: function() { | ||
exports_1("value2", value2 = "v"); | ||
} | ||
} | ||
}); | ||
//// [file2.js] | ||
System.register(["./file3"], function(exports_1) { | ||
var moduleCStar, file3_1, file3_2; | ||
return { | ||
setters:[ | ||
function (moduleCStar_1) { | ||
moduleCStar = moduleCStar_1; | ||
file3_1 = moduleCStar_1; | ||
file3_2 = moduleCStar_1; | ||
}], | ||
execute: function() { | ||
exports_1("moduleCStar", moduleCStar); | ||
exports_1("moduleC", file3_1["default"]); | ||
exports_1("value", file3_2.value); | ||
} | ||
} | ||
}); | ||
//// [file1.js] | ||
System.register(["./file2"], function(exports_1) { | ||
var moduleB; | ||
return { | ||
setters:[ | ||
function (moduleB_1) { | ||
moduleB = moduleB_1; | ||
}], | ||
execute: function() { | ||
use(moduleB.value); | ||
use(moduleB.moduleC); | ||
use(moduleB.moduleCStar); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
|
||
|
||
import * as moduleB from "./file2" | ||
>moduleB : Symbol(moduleB, Decl(file1.ts, 2, 6)) | ||
|
||
declare function use(v: any): void; | ||
>use : Symbol(use, Decl(file1.ts, 2, 34)) | ||
>v : Symbol(v, Decl(file1.ts, 4, 21)) | ||
|
||
use(moduleB.value); | ||
>use : Symbol(use, Decl(file1.ts, 2, 34)) | ||
>moduleB.value : Symbol(moduleB.value, Decl(file2.ts, 8, 12)) | ||
>moduleB : Symbol(moduleB, Decl(file1.ts, 2, 6)) | ||
>value : Symbol(moduleB.value, Decl(file2.ts, 8, 12)) | ||
|
||
use(moduleB.moduleC); | ||
>use : Symbol(use, Decl(file1.ts, 2, 34)) | ||
>moduleB.moduleC : Symbol(moduleB.moduleC, Decl(file2.ts, 7, 16)) | ||
>moduleB : Symbol(moduleB, Decl(file1.ts, 2, 6)) | ||
>moduleC : Symbol(moduleB.moduleC, Decl(file2.ts, 7, 16)) | ||
|
||
use(moduleB.moduleCStar); | ||
>use : Symbol(use, Decl(file1.ts, 2, 34)) | ||
>moduleB.moduleCStar : Symbol(moduleB.moduleCStar, Decl(file2.ts, 6, 8)) | ||
>moduleB : Symbol(moduleB, Decl(file1.ts, 2, 6)) | ||
>moduleCStar : Symbol(moduleB.moduleCStar, Decl(file2.ts, 6, 8)) | ||
|
||
=== tests/cases/compiler/file2.ts === | ||
|
||
import * as moduleCStar from "./file3" | ||
>moduleCStar : Symbol(moduleCStar, Decl(file2.ts, 1, 6)) | ||
|
||
import {value2} from "./file4" | ||
>value2 : Symbol(value2, Decl(file2.ts, 2, 8)) | ||
|
||
import moduleC from "./file3" | ||
>moduleC : Symbol(moduleC, Decl(file2.ts, 3, 6)) | ||
|
||
import {value} from "./file3" | ||
>value : Symbol(value, Decl(file2.ts, 4, 8)) | ||
|
||
export { | ||
moduleCStar, | ||
>moduleCStar : Symbol(moduleCStar, Decl(file2.ts, 6, 8)) | ||
|
||
moduleC, | ||
>moduleC : Symbol(moduleC, Decl(file2.ts, 7, 16)) | ||
|
||
value | ||
>value : Symbol(value, Decl(file2.ts, 8, 12)) | ||
} | ||
|
||
=== tests/cases/compiler/file3.ts === | ||
|
||
export var value = "youpi"; | ||
>value : Symbol(value, Decl(file3.ts, 1, 10)) | ||
|
||
export default value; | ||
>value : Symbol(value, Decl(file3.ts, 1, 10)) | ||
|
||
=== tests/cases/compiler/file4.ts === | ||
|
||
export var value2 = "v"; | ||
>value2 : Symbol(value2, Decl(file4.ts, 1, 10)) | ||
|
Oops, something went wrong.