Make sure the array component we check is properly referenced from the generated file
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 15 Apr 2015 12:29:45 +0200
changeset 1823999cf0169156
parent 1822 01269e6d4e95
child 1824 9fb23d7831da
Make sure the array component we check is properly referenced from the generated file
rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Wed Apr 15 12:23:59 2015 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Wed Apr 15 12:29:45 2015 +0200
     1.3 @@ -2413,7 +2413,9 @@
     1.4                  cnt++;
     1.5              }
     1.6              if (type.charAt(cnt) == 'L') {
     1.7 -                type = "vm." + mangleClassName(type.substring(cnt + 1, type.length() - 1));
     1.8 +                String component = type.substring(cnt + 1, type.length() - 1);
     1.9 +                requireReference(component);
    1.10 +                type = "vm." + mangleClassName(component);
    1.11                  emit(smapper, this, 
    1.12                      "var @2 = Array.prototype['isInstance__ZLjava_lang_Object_2ILjava_lang_Object_2'](@1, @4, @3);",
    1.13                      smapper.popA(), smapper.pushI(),
    1.14 @@ -2440,7 +2442,9 @@
    1.15                  cnt++;
    1.16              }
    1.17              if (type.charAt(cnt) == 'L') {
    1.18 -                type = "vm." + mangleClassName(type.substring(cnt + 1, type.length() - 1));
    1.19 +                String component = type.substring(cnt + 1, type.length() - 1);
    1.20 +                requireReference(component);
    1.21 +                type = "vm." + mangleClassName(component);
    1.22                  emitNoFlush(smapper, 
    1.23                      "if (@1 !== null && !Array.prototype['isInstance__ZLjava_lang_Object_2ILjava_lang_Object_2'](@1, @3, @2)) vm.java_lang_Class(false).castEx();",
    1.24                       smapper.getT(0, VarType.REFERENCE, false), type, "" + cnt