Revision: 10328
Author:   [email protected]
Date:     Mon Jun 13 12:05:05 2011
Log:      Fix enum switch construction in GwtAstBuilder.

The existing code breaks on switch(Integer), it tries to tack an ordinal() call on the end of the unbox.

http://gwt-code-reviews.appspot.com/1450815/

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=10328

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java Fri Jun 10 05:39:40 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java Mon Jun 13 12:05:05 2011
@@ -1366,8 +1366,8 @@
         JBlock block = popBlock(info, x.statements);
         JExpression expression = pop(x.expression);

-        if (x.expression.resolvedType instanceof ReferenceBinding) {
-          // Must be an enum; synthesize a call to ordinal().
+        if (x.expression.resolvedType.isEnum()) {
+          // synthesize a call to ordinal().
           ReferenceBinding javaLangEnum = scope.getJavaLangEnum();
           MethodBinding ordinal = javaLangEnum.getMethods(ORDINAL)[0];
expression = new JMethodCall(info, expression, typeMap.get(ordinal));

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to