Skip to content

Commit 4498b28

Browse files
committed
Use outer-most identifier when resolving queued exports, fixes AssemblyScript#248
1 parent c769f65 commit 4498b28

17 files changed

+193
-144
lines changed

dist/asc.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/asc.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assemblyscript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assemblyscript.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 55 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
"dependencies": {
1414
"@protobufjs/utf8": "^1.1.0",
1515
"binaryen": "49.0.0-nightly.20180731",
16-
"glob": "^7.1.2",
16+
"glob": "^7.1.3",
1717
"long": "^4.0.0"
1818
},
1919
"devDependencies": {
20-
"@types/node": "^10.5.4",
20+
"@types/node": "^10.9.4",
2121
"browser-process-hrtime": "^0.1.2",
2222
"diff": "^3.5.0",
23-
"ts-loader": "^4.4.2",
23+
"ts-loader": "^4.5.0",
2424
"ts-node": "^6.2.0",
2525
"tslint": "^5.11.0",
2626
"typedoc": "^0.11.1",
2727
"typedoc-plugin-external-module-name": "^1.1.3",
28-
"typescript": "^3.0.1",
29-
"webpack": "^4.16.3",
28+
"typescript": "^3.0.3",
29+
"webpack": "^4.17.2",
3030
"webpack-cli": "^3.1.0"
3131
},
3232
"main": "index.js",

src/program.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ export class Program extends DiagnosticEmitter {
539539
this.setExportAndCheckLibrary(
540540
exportName,
541541
element,
542-
currentExport.member.externalName
542+
queuedExport.member.externalName
543543
);
544544
break;
545545
}
@@ -562,7 +562,7 @@ export class Program extends DiagnosticEmitter {
562562
this.setExportAndCheckLibrary(
563563
exportName,
564564
element,
565-
currentExport.member.externalName
565+
queuedExport.member.externalName
566566
);
567567
} else {
568568
this.error(

std/assembly/string.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export class String {
1717

1818
// TODO Add and handle second argument
1919
static fromCharCode(code: i32): String {
20-
if (!code) return changetype<String>("\0");
2120
var out = allocateUnsafe(1);
2221
store<u16>(
2322
changetype<usize>(out),
@@ -28,8 +27,7 @@ export class String {
2827
}
2928

3029
static fromCodePoint(code: i32): String {
31-
assert(<u32>code <= 0x10FFFF); // Invalid code point range
32-
if (!code) return changetype<String>("\0");
30+
assert(<u32>code <= 0x10FFFF);
3331
var sur = code > 0xFFFF;
3432
var out = allocateUnsafe(<i32>sur + 1);
3533
if (!sur) {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
(module
2+
(type $iii (func (param i32 i32) (result i32)))
3+
(type $v (func))
4+
(global $export/a i32 (i32.const 1))
5+
(global $export/b i32 (i32.const 2))
6+
(memory $0 0)
7+
(export "memory" (memory $0))
8+
(export "a" (global $export/a))
9+
(export "renamed_a" (global $export/a))
10+
(export "renamed_b" (global $export/b))
11+
(export "renamed_renamed_b" (global $export/b))
12+
(start $start)
13+
(func $export/add (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
14+
(i32.add
15+
(get_local $0)
16+
(get_local $1)
17+
)
18+
)
19+
(func $export/mul (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
20+
(i32.mul
21+
(get_local $0)
22+
(get_local $1)
23+
)
24+
)
25+
(func $start (; 2 ;) (; has Stack IR ;) (type $v)
26+
(drop
27+
(i32.add
28+
(call $export/add
29+
(i32.const 1)
30+
(i32.const 2)
31+
)
32+
(call $export/mul
33+
(i32.const 3)
34+
(i32.const 4)
35+
)
36+
)
37+
)
38+
)
39+
)

tests/compiler/rereexport.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export {
2+
a,
3+
a as renamed_a,
4+
renamed_b,
5+
renamed_b as renamed_renamed_b
6+
} from "./reexport";

0 commit comments

Comments
 (0)