Makes native static property accessors work.
Change-Id: I77db2b818b13eb865c4982bc5e2c43cd78e8d5cc
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 d5a53bc..07552c3 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
@@ -874,19 +874,19 @@
if (method.isStatic()) {
return dispatchToStatic(qualifier, method, args, methodCall.getSourceInfo());
} else if (methodCall.isStaticDispatchOnly()) {
- return dispatchToSuper(qualifier, method, args, methodCall.getSourceInfo());
+ return dispatchToSuper(qualifier, method, args, methodCall.getSourceInfo());
} else if (method.isOrOverridesJsFunctionMethod()) {
- return dispatchToJsFunction(qualifier, args, methodCall.getSourceInfo());
+ return dispatchToJsFunction(qualifier, args, methodCall.getSourceInfo());
} else {
- return dispatchToInstanceMethod(qualifier, method, args, methodCall.getSourceInfo());
+ return dispatchToInstanceMethod(qualifier, method, args, methodCall.getSourceInfo());
}
}
private JsExpression dispatchToStatic(JsExpression unnecessaryQualifier, JMethod method,
List<JsExpression> args, SourceInfo sourceInfo) {
JsNameRef methodName = createStaticReference(method, sourceInfo);
- JsExpression result = new JsInvocation(sourceInfo, methodName, args);
-
+ JsExpression result = JsUtils.createInvocationOrPropertyAccess(
+ sourceInfo, method.getJsPropertyAccessorType(), methodName, args);
return JsUtils.createCommaExpression(unnecessaryQualifier, result);
}
diff --git a/user/test/com/google/gwt/core/client/interop/JsMethodTest.java b/user/test/com/google/gwt/core/client/interop/JsMethodTest.java
index 2eef104..fc0cd81 100644
--- a/user/test/com/google/gwt/core/client/interop/JsMethodTest.java
+++ b/user/test/com/google/gwt/core/client/interop/JsMethodTest.java
@@ -57,4 +57,27 @@
assertTrue(isFinite(0));
assertTrue(isFinite(1));
}
+
+ @JsProperty(namespace = GLOBAL, name = "NaN")
+ private static native double getNaN();
+
+ @JsProperty(namespace = GLOBAL, name = "Infinity")
+ private static native double infinity();
+
+ public void testStaticNativeJsPropertyGetter() {
+ assertTrue(getNaN() != getNaN());
+ assertTrue(Double.isInfinite(infinity()));
+ assertTrue(Double.isInfinite(-infinity()));
+ }
+
+ @JsProperty(namespace = GLOBAL)
+ private static native void setJsInteropSecret(String magic);
+
+ @JsProperty(namespace = GLOBAL)
+ private static native String getJsInteropSecret();
+
+ public void testStaticNativeJsPropertySetter() {
+ setJsInteropSecret("very secret!");
+ assertEquals("very secret!", getJsInteropSecret());
+ }
}