Skip to content

Commit

Permalink
Add clarifying comment
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 588904316
  • Loading branch information
shicks authored and copybara-github committed Dec 7, 2023
1 parent 522f7d9 commit eb96617
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/com/google/javascript/jscomp/GatherModuleMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ private void visitGoogCall(NodeTraversal t, Node n) {
toggleModules.add(nameVar);
toggleModuleNames.add(name);
} else if (currentModule.metadataBuilder.moduleType() != ModuleType.GOOG_PROVIDE) {
// Side-effect toggle-module imports are not allowed, since they don't actually do
// anything. We allow it in `goog.provide()` files because there's no other way to
// import, and since toggle modules don't declare a legacy namespace, it's unusable
// without a `goog.module.get()` (so we can catch the toggle use there, instead).
t.report(n, INVALID_TOGGLE_USAGE, "import must be assigned");
}
}
Expand Down

0 comments on commit eb96617

Please sign in to comment.