Use string names for annotation properties and exported methods to define enums closure
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 13 May 2014 13:34:14 +0200
branchclosure
changeset 1564380564345434
parent 1563 31bd01cfe50d
child 1565 8977a022e424
Use string names for annotation properties and exported methods to define enums
rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Tue May 13 11:29:16 2014 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Tue May 13 13:34:14 2014 +0200
     1.3 @@ -1981,7 +1981,7 @@
     1.4                  }
     1.5                  cnt[++depth] = 0;
     1.6                  if (attrName != null) {
     1.7 -                    append(attrName).append(" : ");
     1.8 +                    append('"').append(attrName).append("\" : ");
     1.9                  }
    1.10                  if (type == '[') {
    1.11                      append("[");
    1.12 @@ -2011,8 +2011,13 @@
    1.13                  final String slashType = attrType.substring(1, attrType.length() - 1);
    1.14                  requireReference(slashType);
    1.15                  
    1.16 -                append(accessClass(mangleClassName(slashType)))
    1.17 -                   .append("(false).constructor.fld_").append(value);
    1.18 +                final String cn = mangleClassName(slashType);
    1.19 +                append(accessClass(cn))
    1.20 +                   .append("(false)['valueOf__L").
    1.21 +                    append(cn).
    1.22 +                    append("_2Ljava_lang_String_2']('").
    1.23 +                    append(value).
    1.24 +                    append("')");
    1.25              }
    1.26          };
    1.27          ap.parse(data, cd);