@@ -718,9 +718,9 @@ class JSCodeGen()(implicit ctx: Context) {
718
718
if (sym.is(Module )) {
719
719
assert(! sym.is(Package ), " Cannot use package as value: " + tree)
720
720
genLoadModule(sym)
721
- } else /* if (sym.isStaticMember ) {
722
- genStaticMember (sym)
723
- } else if (paramAccessorLocals contains sym) {
721
+ } else if (sym.is( JavaStatic ) ) {
722
+ genLoadStaticField (sym)
723
+ } else /* if (paramAccessorLocals contains sym) {
724
724
paramAccessorLocals(sym).ref
725
725
} else if (isScalaJSDefinedJSClass(sym.owner)) {
726
726
val genQual = genExpr(qualifier)
@@ -2328,6 +2328,24 @@ class JSCodeGen()(implicit ctx: Context) {
2328
2328
}
2329
2329
}
2330
2330
2331
+ /** Gen JS code for loading a Java static field.
2332
+ */
2333
+ private def genLoadStaticField (sym : Symbol )(implicit pos : Position ): js.Tree = {
2334
+ /* Actually, there is no static member in Scala.js. If we come here, that
2335
+ * is because we found the symbol in a Java-emitted .class in the
2336
+ * classpath. But the corresponding implementation in Scala.js will
2337
+ * actually be a val in the companion module.
2338
+ */
2339
+
2340
+ if (sym == defn.BoxedUnit_UNIT ) {
2341
+ js.Undefined ()
2342
+ } else {
2343
+ val instance = genLoadModule(sym.owner)
2344
+ val method = encodeStaticMemberSym(sym)
2345
+ js.Apply (instance, method, Nil )(toIRType(sym.info))
2346
+ }
2347
+ }
2348
+
2331
2349
/** Gen JS code for loading a module.
2332
2350
*
2333
2351
* Can be given either the module symbol, or its module class symbol.
0 commit comments