Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 631bde3

Browse files
vikermanrkirov
authored andcommitted
Fix re-exporting variables with __ prefix.
Reviewers: vikerman, evmar Reviewed By: vikerman, evmar Subscribers: typescript-eng Differential Revision: https://reviews.angular.io/D130
1 parent ad9b601 commit 631bde3

File tree

7 files changed

+13
-1
lines changed

7 files changed

+13
-1
lines changed

src/tsickle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class Annotator extends Rewriter {
342342
typeChecker.getExportsOfModule(typeChecker.getSymbolAtLocation(exportDecl.moduleSpecifier));
343343
let reexports: {[name: string]: boolean} = {};
344344
for (let sym of exports) {
345-
let name = sym.name;
345+
let name = unescapeName(sym.name);
346346
if (localSet.hasOwnProperty(name)) {
347347
// This name is shadowed by a local definition, such as:
348348
// - export var foo ...
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
goog.module('tsickle_test.underscore.export_underscore');
2+
exports.__test = 1;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export var __test = 1;
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export var /** @type {number} */ __test = 1;
2+

test_files/underscore/underscore.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
goog.module('tsickle_test.underscore.underscore');// Verify that double-underscored names in various places don't get corrupted.
22
// See getIdentifierText() in tsickle.ts.
33

4+
var export_underscore_1 = goog.require('tsickle_test.underscore.export_underscore');
5+
exports.__test = export_underscore_1.__test;
46
let /** @type {number} */ __foo = 3;
57
exports.__bar = __foo;
68
class __Class {

test_files/underscore/underscore.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Verify that double-underscored names in various places don't get corrupted.
22
// See getIdentifierText() in tsickle.ts.
33

4+
export * from './export_underscore';
5+
46
let __foo = 3;
57
export {__foo as __bar};
68
class __Class {

test_files/underscore/underscore.tsickle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Verify that double-underscored names in various places don't get corrupted.
22
// See getIdentifierText() in tsickle.ts.
33

4+
export {__test} from './export_underscore';
5+
46
let /** @type {number} */ __foo = 3;
57
export {__foo as __bar};
68
class __Class {

0 commit comments

Comments
 (0)