diff --git a/tools/mujs/lib/compiler/transform.ts b/tools/mujs/lib/compiler/transform.ts index 15fca0483..b38d2e728 100644 --- a/tools/mujs/lib/compiler/transform.ts +++ b/tools/mujs/lib/compiler/transform.ts @@ -282,6 +282,15 @@ export class Transformer { return path; } + // extractMemberToken returns just the member part of a fully qualified token, leaving off the module part. + private extractMemberToken(token: symbols.Token): symbols.Token { + let sepIndex: number = token.indexOf(symbols.moduleSep); + if (sepIndex !== -1) { + token = token.substring(sepIndex+1); + } + return token; + } + // resolveModuleSymbol binds either a name or a path to an associated module symbol. private resolveModuleSymbol(node: ts.Node, name?: string, path?: string): ts.Symbol { // Resolve the module name to a real symbol. @@ -601,7 +610,7 @@ export class Transformer { kind: ast.exportKind, name: { kind: ast.identifierKind, - ident: name, + ident: this.extractMemberToken(name), }, token: name, }); diff --git a/tools/mujs/tests/output/modules/reexport_all/Mu.out.json b/tools/mujs/tests/output/modules/reexport_all/Mu.out.json index 3aa3bb8d2..99cb6ef8e 100644 --- a/tools/mujs/tests/output/modules/reexport_all/Mu.out.json +++ b/tools/mujs/tests/output/modules/reexport_all/Mu.out.json @@ -188,27 +188,27 @@ "ident": "index" }, "members": { - "other:C": { + "C": { "kind": "Export", "name": { "kind": "Identifier", - "ident": "other:C" + "ident": "C" }, "token": "other:C" }, - "other:I": { + "I": { "kind": "Export", "name": { "kind": "Identifier", - "ident": "other:I" + "ident": "I" }, "token": "other:I" }, - "other:v": { + "v": { "kind": "Export", "name": { "kind": "Identifier", - "ident": "other:v" + "ident": "v" }, "token": "other:v" }