Ray Cromwell has uploaded a new change for review.

  https://gwt-review.googlesource.com/1810


Change subject: Currently the GWT compiler adds a var declaration for each catch parameter in a try/catch statement, but this is unneeded according to the spec, and the Closure compiler will issue errors against it.
......................................................................

Currently the GWT compiler adds a var declaration for each catch parameter in
a try/catch statement, but this is unneeded according to the spec, and the
Closure compiler will issue errors against it.

Change-Id: I05dd0429ec22315d57069046b0139ecce045919e
---
M dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
1 file changed, 6 insertions(+), 1 deletion(-)



diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
index 81ad168..6b86885 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
@@ -439,6 +439,7 @@
         JsParameter jsParam = jsCatch.getParameter();
         names.put(arg.getTarget(), jsParam.getName());
         catchMap.put(catchBlock, jsCatch);
+        catchParamIdentifiers.add(jsParam.getName());

         push(jsCatch.getScope());
         accept(catchBlock);
@@ -1146,7 +1147,9 @@
       for (int i = 0; i < locals.size(); ++i) {
         JsName name = names.get(x.getLocals().get(i));
         String ident = name.getIdent();
-        if (!alreadySeen.contains(ident)) {
+        if (!alreadySeen.contains(ident)
+            // Catch block params don't need var declarations
+            && !catchParamIdentifiers.contains(name)) {
           alreadySeen.add(ident);
           vars.add(new JsVar(x.getSourceInfo(), name));
         }
@@ -2337,6 +2340,8 @@

private final Map<JBlock, JsCatch> catchMap = new IdentityHashMap<JBlock, JsCatch>();

+  private final Set<JsName> catchParamIdentifiers = new HashSet<JsName>();
+
private final Map<JClassType, JsScope> classScopes = new IdentityHashMap<JClassType, JsScope>();

   /**

--
To view, visit https://gwt-review.googlesource.com/1810
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05dd0429ec22315d57069046b0139ecce045919e
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Ray Cromwell <cromwell...@google.com>

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to