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: zundel@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10328 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
index 50d98cb..120e4ed 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
@@ -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));