Skip to content

Commit

Permalink
fixed files form Closure #26
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent d8e7475 commit 91dfcef
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ private class ProcessCommonJsModulesCallback extends
AbstractPostOrderCallback {

private int scriptNodeCount = 0;
private Set<String> modulesWithExports = Sets.newHashSet();

@Override
public void visit(NodeTraversal t, Node n, Node parent) {
Expand Down Expand Up @@ -204,6 +205,9 @@ private void visitScript(NodeTraversal t, Node script) {
*/
private void emitOptionalModuleExportsOverride(Node script,
String moduleName) {
if (!modulesWithExports.contains(moduleName)) {
return;
}

Node moduleExportsProp = IR.getprop(IR.name(moduleName),
IR.string("module$exports"));
Expand All @@ -225,6 +229,7 @@ private void visitModuleExports(Node prop) {
Node exports = prop.getChildAtIndex(1);
exports.putProp(Node.ORIGINALNAME_PROP, "exports");
exports.setString("module$exports");
modulesWithExports.add(moduleName);
}

/**
Expand Down

0 comments on commit 91dfcef

Please sign in to comment.