Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java

Issue 1319263002: Fix Chrome-specific closure pass for cr.exportPath() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/closure_compiler/runner/runner.jar ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java
diff --git a/third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java b/third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java
index 8a4d814666b4c4e7422f4f640fbbe892dc7549a0..51d7e211ae34f5ef6a8e6edbdcaaa9b375f880d1 100644
--- a/third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java
+++ b/third_party/closure_compiler/runner/src/com/google/javascript/jscomp/ChromePass.java
@@ -46,9 +46,9 @@ public class ChromePass extends AbstractPostOrderCallback implements CompilerPas
DiagnosticType.error("JSC_CR_DEFINE_WRONG_NUMBER_OF_ARGUMENTS",
"cr.define() should have exactly 2 arguments. " + CR_DEFINE_COMMON_EXPLANATION);
- static final DiagnosticType CR_EXPORT_PATH_WRONG_NUMBER_OF_ARGUMENTS =
- DiagnosticType.error("JSC_CR_EXPORT_PATH_WRONG_NUMBER_OF_ARGUMENTS",
- "cr.exportPath() should have exactly 1 argument: namespace name.");
+ static final DiagnosticType CR_EXPORT_PATH_TOO_FEW_ARGUMENTS =
+ DiagnosticType.error("JSC_CR_EXPORT_PATH_TOO_FEW_ARGUMENTS",
+ "cr.exportPath() should have at least 1 argument: path name.");
static final DiagnosticType CR_DEFINE_INVALID_FIRST_ARGUMENT =
DiagnosticType.error("JSC_CR_DEFINE_INVALID_FIRST_ARGUMENT",
@@ -250,14 +250,15 @@ public class ChromePass extends AbstractPostOrderCallback implements CompilerPas
}
private void visitExportPath(Node crExportPathNode, Node parent) {
- if (crExportPathNode.getChildCount() != 2) {
- compiler.report(JSError.make(crExportPathNode,
- CR_EXPORT_PATH_WRONG_NUMBER_OF_ARGUMENTS));
+ if (crExportPathNode.getChildCount() < 2) {
+ compiler.report(JSError.make(crExportPathNode, CR_EXPORT_PATH_TOO_FEW_ARGUMENTS));
return;
}
- createAndInsertObjectsForQualifiedName(parent,
- crExportPathNode.getChildAtIndex(1).getString());
+ Node pathArg = crExportPathNode.getChildAtIndex(1);
+ if (pathArg.isString()) {
+ createAndInsertObjectsForQualifiedName(parent, pathArg.getString());
+ }
}
private void createAndInsertObjectsForQualifiedName(Node scriptChild, String namespace) {
« no previous file with comments | « third_party/closure_compiler/runner/runner.jar ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698