Chromium Code Reviews| 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..dba31009928b488dfb7f44950f1ebd8891333357 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 |
| @@ -48,7 +48,8 @@ public class ChromePass extends AbstractPostOrderCallback implements CompilerPas |
| 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."); |
| + "cr.exportPath() should have between 1 and 3 arguments: " |
| + + "namespace name[, object to expose[, object to export to]]."); |
| static final DiagnosticType CR_DEFINE_INVALID_FIRST_ARGUMENT = |
| DiagnosticType.error("JSC_CR_DEFINE_INVALID_FIRST_ARGUMENT", |
| @@ -250,11 +251,13 @@ public class ChromePass extends AbstractPostOrderCallback implements CompilerPas |
| } |
| private void visitExportPath(Node crExportPathNode, Node parent) { |
| - if (crExportPathNode.getChildCount() != 2) { |
| + int childCount = crExportPathNode.getChildCount(); |
| + if (childCount < 2 || childCount > 4) { |
| compiler.report(JSError.make(crExportPathNode, |
| CR_EXPORT_PATH_WRONG_NUMBER_OF_ARGUMENTS)); |
| - return; |
| } |
| + if (childCount != 2) |
| + return; |
| createAndInsertObjectsForQualifiedName(parent, |
| crExportPathNode.getChildAtIndex(1).getString()); |
|
Dan Beam
2015/08/29 01:49:30
cr.exportPath(pathName); // throws without a 'lit
michaelpg
2015/08/29 01:53:23
Acknowledged.
|