This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new d46a484 Improved formatting of generated JS for MXML attributes so
that it's easier to debug
d46a484 is described below
commit d46a4846ad11f10e5603346640f969cc6f0f83d5
Author: Josh Tynjala <[email protected]>
AuthorDate: Mon Feb 10 15:42:41 2020 -0800
Improved formatting of generated JS for MXML attributes so that it's easier
to debug
In particular, nested objects now appear on multiple lines, just like the
top level, and indentation is updated to reflect nesting level
---
.../mxml/royale/MXMLDescriptorSpecifier.java | 79 +-
.../codegen/mxml/royale/MXMLNodeSpecifier.java | 5 +
.../codegen/mxml/royale/MXMLRoyaleEmitter.java | 33 +-
.../mxml/royale/TestRoyaleMXMLApplication.java | 331 ++++++--
.../mxml/sourcemaps/TestSourceMapMXMLEvents.java | 2 +-
.../resources/royale/files/MyInitialView_result.js | 876 ++++++++++++---------
.../royale/files/RoyaleTest_again_result.js | 120 ++-
7 files changed, 944 insertions(+), 502 deletions(-)
diff --git
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLDescriptorSpecifier.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLDescriptorSpecifier.java
index 048cb93..2117489 100644
---
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLDescriptorSpecifier.java
+++
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLDescriptorSpecifier.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import org.apache.royale.compiler.internal.codegen.as.ASEmitterTokens;
import org.apache.royale.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
+import
org.apache.royale.compiler.internal.codegen.js.royale.JSRoyaleEmitterTokens;
/**
* @author Erik de Bruin
@@ -118,6 +119,12 @@ public class MXMLDescriptorSpecifier extends
MXMLNodeSpecifier
public MXMLDescriptorSpecifier parent;
+ //---------------------------------
+ // currentIndent
+ //---------------------------------
+
+ private int currentIndent = 0;
+
public boolean useGoogReflectObjectProperty = false;
//--------------------------------------------------------------------------
@@ -127,6 +134,47 @@ public class MXMLDescriptorSpecifier extends
MXMLNodeSpecifier
//--------------------------------------------------------------------------
//---------------------------------
+ // indent
+ //---------------------------------
+
+ protected String getIndent()
+ {
+ return getIndent(currentIndent);
+ }
+
+ protected String getIndent(int numIndent)
+ {
+ final StringBuilder sb = new StringBuilder();
+ if (parent != null)
+ {
+ sb.append(parent.getIndent());
+ }
+ for (int i = 0; i < numIndent; i++)
+ sb.append(JSRoyaleEmitterTokens.INDENT.getToken());
+ return sb.toString();
+ }
+
+ public void indentPush()
+ {
+ currentIndent++;
+ }
+
+ public void indentPop()
+ {
+ if (currentIndent > 0)
+ {
+ currentIndent--;
+ }
+ }
+
+ @Override
+ protected void writeNewline()
+ {
+ write(ASEmitterTokens.NEW_LINE);
+ write(getIndent(currentIndent));
+ }
+
+ //---------------------------------
// outputEventSpecifier
//---------------------------------
@@ -192,10 +240,13 @@ public class MXMLDescriptorSpecifier extends
MXMLNodeSpecifier
else
{
write((hasArray) ? ASEmitterTokens.NULL :
ASEmitterTokens.FALSE);
- writeDelimiter(writeNewline && !hasArray);
-
+ writeDelimiter(writeNewline);
write(ASEmitterTokens.SQUARE_OPEN);
- output(false);
+ indentPush();
+ writeNewline();
+ output(writeNewline);
+ indentPop();
+ writeNewline();
write(ASEmitterTokens.SQUARE_CLOSE);
}
@@ -285,7 +336,9 @@ public class MXMLDescriptorSpecifier extends
MXMLNodeSpecifier
}
if (model != null)
- write(model.outputPropertySpecifier(true));
+ {
+ write(model.outputPropertySpecifier(writeNewline));
+ }
for (MXMLDescriptorSpecifier md : propertySpecifiers)
{
@@ -299,7 +352,9 @@ public class MXMLDescriptorSpecifier extends
MXMLNodeSpecifier
}
if (beads != null)
+ {
write(beads.outputPropertySpecifier(writeNewline));
+ }
if (!isProperty)
{
@@ -334,16 +389,26 @@ public class MXMLDescriptorSpecifier extends
MXMLNodeSpecifier
private void outputChildren(MXMLDescriptorSpecifier children, boolean
writeNewline)
{
write(ASEmitterTokens.SQUARE_OPEN.getToken());
- write(children.output(false));
+ if(writeNewline)
+ {
+ indentPush();
+ writeNewline();
+ }
+ write(children.output(writeNewline));
+ if(writeNewline)
+ {
+ indentPop();
+ writeNewline();
+ }
write(ASEmitterTokens.SQUARE_CLOSE.getToken());
}
- public String outputStateDescriptors()
+ public String outputStateDescriptors(boolean writeNewLine)
{
for (MXMLDescriptorSpecifier md : propertySpecifiers)
{
write(ASEmitterTokens.SQUARE_OPEN);
- write(md.output(false));
+ write(md.output(writeNewLine));
write(ASEmitterTokens.SQUARE_CLOSE);
writeNewline(ASEmitterTokens.COMMA);
}
diff --git
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLNodeSpecifier.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLNodeSpecifier.java
index abf7e53..62d4b6e 100644
---
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLNodeSpecifier.java
+++
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLNodeSpecifier.java
@@ -128,6 +128,11 @@ public class MXMLNodeSpecifier
protected void writeNewline(String value)
{
write(value);
+ writeNewline();
+ }
+
+ protected void writeNewline()
+ {
write(ASEmitterTokens.NEW_LINE);
}
diff --git
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
index 34b1480..30baeae 100644
---
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
+++
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java
@@ -1109,7 +1109,7 @@ public class MXMLRoyaleEmitter extends MXMLEmitter
implements
writeNewline(" */");
writeNewline("this.mxmlsd = " +
ASEmitterTokens.SQUARE_OPEN.getToken());
indentPush();
- write(root.outputStateDescriptors());
+ write(root.outputStateDescriptors(false));
write("null");
write(ASEmitterTokens.SQUARE_CLOSE);
indentPop();
@@ -1130,13 +1130,20 @@ public class MXMLRoyaleEmitter extends MXMLEmitter
implements
{
indentPush();
writeNewline();
- writeNewline("this.generateMXMLAttributes");
+ write("this.generateMXMLAttributes");
write(ASEmitterTokens.PAREN_OPEN);
- write(ASEmitterTokens.SQUARE_OPEN);
+ indentPush();
+ writeNewline(ASEmitterTokens.SQUARE_OPEN);
MXMLDescriptorSpecifier root = propertiesTree;
root.isTopNode = true;
- writeNewline(root.output(true));
+ for(int i = 0; i < getCurrentIndent(); i++)
+ {
+ root.indentPush();
+ }
+ write(root.output(true));
+ indentPop();
+ writeNewline();
collectExportedNames(root);
@@ -2171,25 +2178,25 @@ public class MXMLRoyaleEmitter extends MXMLEmitter
implements
writeNewline("/** @this {" + formatQualifiedName(cname) + "} */");
indentPush();
writeNewline("get: function() {");
- indentPush();
- writeNewline("{");
writeNewline("if (this.mxmldd == undefined)");
indentPush();
writeNewline("{");
writeNewline("/** @type {Array} */");
writeNewline("var arr = " + formatQualifiedName(cname) +
".superClass_.get__MXMLDescriptor.apply(this);");
writeNewline("/** @type {Array} */");
- indentPop();
- indentPop();
+ indentPush();
writeNewline("var data = [");
- writeNewline(root.output(true));
+ for(int i = 0; i < getCurrentIndent(); i++)
+ {
+ root.indentPush();
+ }
+ write(root.output(true));
+ indentPop();
+ writeNewline();
- indentPush();
writeNewline("];");
indentPush();
- writeNewline("");
- indentPush();
writeNewline("if (arr)");
indentPop();
writeNewline("this.mxmldd = arr.concat(data);");
@@ -2201,11 +2208,11 @@ public class MXMLRoyaleEmitter extends MXMLEmitter
implements
writeNewline("}");
indentPop();
writeNewline("return this.mxmldd;");
- writeNewline("}");
indentPop();
writeNewline("}");
indentPop();
writeNewline("}");
+ indentPop();
writeNewline("});");
}
diff --git
a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/royale/TestRoyaleMXMLApplication.java
b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/royale/TestRoyaleMXMLApplication.java
index dca288f..fd28862 100644
---
a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/royale/TestRoyaleMXMLApplication.java
+++
b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/royale/TestRoyaleMXMLApplication.java
@@ -373,13 +373,31 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'initialView',\n" +
- "false,\n" +
- "[org.apache.royale.core.View, 1, '_id', true, '$ID1',
0, 0, [org.apache.royale.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'initialView',\n" +
+ " false,\n" +
+ " [\n" +
+ " org.apache.royale.core.View,\n"+
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID1',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " [\n" +
+ " org.apache.royale.html.Label,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ]\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -498,13 +516,31 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'initialView',\n" +
- "false,\n" +
- "[org.apache.royale.core.View, 1, '_id', true, '$ID1',
0, 0, [org.apache.royale.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'initialView',\n" +
+ " false,\n" +
+ " [\n" +
+ " org.apache.royale.core.View,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID1',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " [\n" +
+ " org.apache.royale.html.Label,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ]\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -624,13 +660,31 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'initialView',\n" +
- "false,\n" +
- "[org.apache.royale.core.View, 1, '_id', true, '$ID1',
0, 0, [org.apache.royale.html.Label, 1, '_id', true, '$ID0', 0, 0, null]],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'initialView',\n" +
+ " false,\n" +
+ " [\n" +
+ " org.apache.royale.core.View,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID1',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " [\n" +
+ " org.apache.royale.html.Label,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ]\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -785,13 +839,34 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'initialView',\n" +
- "false,\n" +
- "[org.apache.royale.core.View, 1, '_id', true, '$ID1',
0, 0, [org.apache.royale.html.Label, 2, '_id', true, '$ID0', 'text', true,
'Hello World', 0, 0, null]],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'initialView',\n" +
+ " false,\n" +
+ " [\n" +
+ " org.apache.royale.core.View,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID1',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " [\n" +
+ " org.apache.royale.html.Label,\n" +
+ " 2,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 'text',\n" +
+ " true,\n" +
+ " 'Hello World',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ]\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -911,13 +986,34 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'initialView',\n" +
- "false,\n" +
- "[org.apache.royale.core.View, 1, '_id', true, '$ID1',
0, 0, [org.apache.royale.html.DropDownList, 2, '_id', true, '$ID0',
'dataProvider', true, ['Hello','World'], 0, 0, null]],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'initialView',\n" +
+ " false,\n" +
+ " [\n" +
+ " org.apache.royale.core.View,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID1',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " [\n" +
+ "
org.apache.royale.html.DropDownList,\n" +
+ " 2,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 'dataProvider',\n" +
+ " true,\n" +
+ " ['Hello','World'],\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ]\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -1035,13 +1131,34 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'initialView',\n" +
- "false,\n" +
- "[org.apache.royale.core.View, 1, '_id', true, '$ID3',
0, 0, [org.apache.royale.html.DropDownList, 2, '_id', true, '$ID2',
'dataProvider', true, ['Hello','World'], 0, 0, null]],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'initialView',\n" +
+ " false,\n" +
+ " [\n" +
+ " org.apache.royale.core.View,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID3',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " [\n" +
+ "
org.apache.royale.html.DropDownList,\n" +
+ " 2,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID2',\n" +
+ " 'dataProvider',\n" +
+ " true,\n" +
+ " ['Hello','World'],\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ]\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -1161,13 +1278,34 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'initialView',\n" +
- "false,\n" +
- "[org.apache.royale.core.View, 1, '_id', true, '$ID1',
0, 0, [org.apache.royale.html.DropDownList, 2, '_id', true, '$ID0',
'dataProvider', true, ['Hello','World'], 0, 0, null]],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'initialView',\n" +
+ " false,\n" +
+ " [\n" +
+ " org.apache.royale.core.View,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID1',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " [\n" +
+ "
org.apache.royale.html.DropDownList,\n" +
+ " 2,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 'dataProvider',\n" +
+ " true,\n" +
+ " ['Hello','World'],\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ]\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -1286,13 +1424,34 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'initialView',\n" +
- "false,\n" +
- "[org.apache.royale.core.View, 1, '_id', true, '$ID1',
0, 0, [org.apache.royale.html.DropDownList, 2, '_id', true, '$ID0',
'dataProvider', true, ['Hello','World'], 0, 0, null]],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'initialView',\n" +
+ " false,\n" +
+ " [\n" +
+ " org.apache.royale.core.View,\n" +
+ " 1,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID1',\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " [\n" +
+ "
org.apache.royale.html.DropDownList,\n" +
+ " 2,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 'dataProvider',\n" +
+ " true,\n" +
+ " ['Hello','World'],\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ]\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -1428,11 +1587,11 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([0,\n" +
- "0,\n" +
- "1,\n" +
- "'change',\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " 1,\n" +
+ " 'change',\n" +
"this.$EH0\n" +
" ]);\n" +
" \n" +
@@ -1574,12 +1733,25 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'beads',\n" +
- "null, [org.apache.royale.charts.beads.DataTipBead, 2,
'_id', true, '$ID0', 'labelFunction', true,
org.apache.royale.utils.Language.closure(this.fn_test, this,
'__org.apache.royale.utils.Language.closure__fn_test'), 0, 0, null],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'beads',\n" +
+ " null,\n" +
+ " [\n" +
+ "
org.apache.royale.charts.beads.DataTipBead,\n" +
+ " 2,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 'labelFunction',\n" +
+ " true,\n" +
+ "
org.apache.royale.utils.Language.closure(this.fn_test, this,
'__org.apache.royale.utils.Language.closure__fn_test'),\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
@@ -1691,12 +1863,25 @@ public class TestRoyaleMXMLApplication extends
RoyaleTestBase
" */\n" +
" this.mxmldp;\n" +
"\n" +
- " this.generateMXMLAttributes\n" +
- " ([1,\n" +
- "'beads',\n" +
- "null, [org.apache.royale.charts.beads.DataTipBead, 2,
'_id', true, '$ID0', 'labelFunction', true,
org.apache.royale.utils.Language.closure(this.AppName_fn_test, this,
'__org.apache.royale.utils.Language.closure__fn_test'), 0, 0, null],\n" +
- "0,\n" +
- "0\n" +
+ " this.generateMXMLAttributes([\n" +
+ " 1,\n" +
+ " 'beads',\n" +
+ " null,\n" +
+ " [\n" +
+ "
org.apache.royale.charts.beads.DataTipBead,\n" +
+ " 2,\n" +
+ " '_id',\n" +
+ " true,\n" +
+ " '$ID0',\n" +
+ " 'labelFunction',\n" +
+ " true,\n" +
+ "
org.apache.royale.utils.Language.closure(this.AppName_fn_test, this,
'__org.apache.royale.utils.Language.closure__fn_test'),\n" +
+ " 0,\n" +
+ " 0,\n" +
+ " null\n" +
+ " ],\n" +
+ " 0,\n" +
+ " 0\n" +
" ]);\n" +
" \n" +
"};\n" +
diff --git
a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLEvents.java
b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLEvents.java
index 1672e31..c937cd0 100644
---
a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLEvents.java
+++
b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/mxml/sourcemaps/TestSourceMapMXMLEvents.java
@@ -37,7 +37,7 @@ public class TestSourceMapMXMLEvents extends
RoyaleSourceMapTestBase
.getAncestorOfType(IMXMLDocumentNode.class);
mxmlBlockWalker.walk(dnode);
///event
- assertMapping(node, 0, 6, 67, 2, 67, 7); // event
+ assertMapping(node, 0, 6, 79, 2, 79, 7); // event
//the start column in the ActionScript seems to be outside the quote
//instead of inside. that seems like a bug. -JT
}
diff --git
a/compiler-jx/src/test/resources/royale/files/MyInitialView_result.js
b/compiler-jx/src/test/resources/royale/files/MyInitialView_result.js
index 81e4dbf..ff557ad 100644
--- a/compiler-jx/src/test/resources/royale/files/MyInitialView_result.js
+++ b/compiler-jx/src/test/resources/royale/files/MyInitialView_result.js
@@ -462,403 +462,501 @@ Object.defineProperties(MyInitialView.prototype, /**
@lends {MyInitialView.proto
'MXMLDescriptor': {
/** @this {MyInitialView} */
get: function() {
+ if (this.mxmldd == undefined)
{
- if (this.mxmldd == undefined)
- {
- /** @type {Array} */
- var arr = MyInitialView.superClass_.get__MXMLDescriptor.apply(this);
- /** @type {Array} */
- var data = [
- org.apache.royale.html.Label,
-4,
-'id',
-true,
-'lbl',
-'x',
-true,
-100,
-'y',
-true,
-25,
-'beads',
-null, [org.apache.royale.binding.SimpleBinding, 5, '_id', true, '$ID0',
'eventName', true, 'labelTextChanged', 'sourceID', true, 'applicationModel',
'sourcePropertyName', true, 'labelText', 'destinationPropertyName', true,
'text', 0, 0, null],
-0,
-0,
-null,
-org.apache.royale.html.TextButton,
-4,
-'_id',
-true,
-'$ID1',
-'text',
-true,
-'Let\'s Start Timer',
-'x',
-true,
-100,
-'y',
-true,
-75,
-0,
-1,
-'click',
+ /** @type {Array} */
+ var arr = MyInitialView.superClass_.get__MXMLDescriptor.apply(this);
+ /** @type {Array} */
+ var data = [
+ org.apache.royale.html.Label,
+ 4,
+ 'id',
+ true,
+ 'lbl',
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 25,
+ 'beads',
+ null,
+ [
+ org.apache.royale.binding.SimpleBinding,
+ 5,
+ '_id',
+ true,
+ '$ID0',
+ 'eventName',
+ true,
+ 'labelTextChanged',
+ 'sourceID',
+ true,
+ 'applicationModel',
+ 'sourcePropertyName',
+ true,
+ 'labelText',
+ 'destinationPropertyName',
+ true,
+ 'text',
+ 0,
+ 0,
+ null
+ ],
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.TextButton,
+ 4,
+ '_id',
+ true,
+ '$ID1',
+ 'text',
+ true,
+ 'Let\'s Start Timer',
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 75,
+ 0,
+ 1,
+ 'click',
this.$EH0,
-null,
-org.apache.royale.html.TextButton,
-4,
-'_id',
-true,
-'$ID2',
-'text',
-true,
-'Stop Timer',
-'x',
-true,
-100,
-'y',
-true,
-100,
-0,
-1,
-'click',
+ null,
+ org.apache.royale.html.TextButton,
+ 4,
+ '_id',
+ true,
+ '$ID2',
+ 'text',
+ true,
+ 'Stop Timer',
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 100,
+ 0,
+ 1,
+ 'click',
this.$EH1,
-null,
-org.apache.royale.html.Label,
-3,
-'id',
-true,
-'timerLabel',
-'x',
-true,
-100,
-'y',
-true,
-125,
-0,
-0,
-null,
-org.apache.royale.html.List,
-6,
-'id',
-true,
-'cityList',
-'x',
-true,
-200,
-'y',
-true,
-75,
-'width',
-true,
-100,
-'height',
-true,
-75,
-'beads',
-null, [org.apache.royale.binding.ConstantBinding, 4, '_id', true, '$ID3',
'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'cities',
'destinationPropertyName', true, 'dataProvider', 0, 0, null],
-0,
-1,
-'change',
+ null,
+ org.apache.royale.html.Label,
+ 3,
+ 'id',
+ true,
+ 'timerLabel',
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 125,
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.List,
+ 6,
+ 'id',
+ true,
+ 'cityList',
+ 'x',
+ true,
+ 200,
+ 'y',
+ true,
+ 75,
+ 'width',
+ true,
+ 100,
+ 'height',
+ true,
+ 75,
+ 'beads',
+ null,
+ [
+ org.apache.royale.binding.ConstantBinding,
+ 4,
+ '_id',
+ true,
+ '$ID3',
+ 'sourceID',
+ true,
+ 'applicationModel',
+ 'sourcePropertyName',
+ true,
+ 'cities',
+ 'destinationPropertyName',
+ true,
+ 'dataProvider',
+ 0,
+ 0,
+ null
+ ],
+ 0,
+ 1,
+ 'change',
this.$EH2,
-null,
-org.apache.royale.html.TextArea,
-6,
-'_id',
-true,
-'$ID5',
-'x',
-true,
-320,
-'y',
-true,
-25,
-'width',
-true,
-150,
-'height',
-true,
-75,
-'beads',
-null, [org.apache.royale.binding.SimpleBinding, 5, '_id', true, '$ID4',
'eventName', true, 'labelTextChanged', 'sourceID', true, 'applicationModel',
'sourcePropertyName', true, 'labelText', 'destinationPropertyName', true,
'text', 0, 0, null],
-0,
-0,
-null,
-org.apache.royale.html.TextInput,
-3,
-'id',
-true,
-'input',
-'x',
-true,
-320,
-'y',
-true,
-110,
-0,
-0,
-null,
-org.apache.royale.html.TextButton,
-4,
-'_id',
-true,
-'$ID6',
-'text',
-true,
-'Transfer',
-'x',
-true,
-320,
-'y',
-true,
-138,
-0,
-1,
-'click',
+ null,
+ org.apache.royale.html.TextArea,
+ 6,
+ '_id',
+ true,
+ '$ID5',
+ 'x',
+ true,
+ 320,
+ 'y',
+ true,
+ 25,
+ 'width',
+ true,
+ 150,
+ 'height',
+ true,
+ 75,
+ 'beads',
+ null,
+ [
+ org.apache.royale.binding.SimpleBinding,
+ 5,
+ '_id',
+ true,
+ '$ID4',
+ 'eventName',
+ true,
+ 'labelTextChanged',
+ 'sourceID',
+ true,
+ 'applicationModel',
+ 'sourcePropertyName',
+ true,
+ 'labelText',
+ 'destinationPropertyName',
+ true,
+ 'text',
+ 0,
+ 0,
+ null
+ ],
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.TextInput,
+ 3,
+ 'id',
+ true,
+ 'input',
+ 'x',
+ true,
+ 320,
+ 'y',
+ true,
+ 110,
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.TextButton,
+ 4,
+ '_id',
+ true,
+ '$ID6',
+ 'text',
+ true,
+ 'Transfer',
+ 'x',
+ true,
+ 320,
+ 'y',
+ true,
+ 138,
+ 0,
+ 1,
+ 'click',
this.$EH3,
-null,
-org.apache.royale.html.CheckBox,
-4,
-'id',
-true,
-'checkbox',
-'x',
-true,
-320,
-'y',
-true,
-170,
-'text',
-true,
-'Check Me',
-0,
-0,
-null,
-org.apache.royale.html.RadioButton,
-6,
-'_id',
-true,
-'$ID7',
-'groupName',
-true,
-'group1',
-'text',
-true,
-'Apples',
-'value',
-true,
-0,
-'x',
-true,
-100,
-'y',
-true,
-150,
-0,
-0,
-null,
-org.apache.royale.html.RadioButton,
-7,
-'_id',
-true,
-'$ID8',
-'groupName',
-true,
-'group1',
-'text',
-true,
-'Oranges',
-'value',
-true,
-1,
-'x',
-true,
-100,
-'y',
-true,
-170,
-'selected',
-true,
-true,
-0,
-0,
-null,
-org.apache.royale.html.RadioButton,
-6,
-'_id',
-true,
-'$ID9',
-'groupName',
-true,
-'group1',
-'text',
-true,
-'Grapes',
-'value',
-true,
-2,
-'x',
-true,
-100,
-'y',
-true,
-190,
-0,
-0,
-null,
-org.apache.royale.html.RadioButton,
-7,
-'_id',
-true,
-'$ID10',
-'groupName',
-true,
-'group2',
-'text',
-true,
-'Red',
-'value',
-true,
-16711680,
-'x',
-true,
-100,
-'y',
-true,
-250,
-'selected',
-true,
-true,
-0,
-0,
-null,
-org.apache.royale.html.RadioButton,
-6,
-'_id',
-true,
-'$ID11',
-'groupName',
-true,
-'group2',
-'text',
-true,
-'Green',
-'value',
-true,
-32768,
-'x',
-true,
-100,
-'y',
-true,
-270,
-0,
-0,
-null,
-org.apache.royale.html.RadioButton,
-6,
-'_id',
-true,
-'$ID12',
-'groupName',
-true,
-'group2',
-'text',
-true,
-'Blue',
-'value',
-true,
-255,
-'x',
-true,
-100,
-'y',
-true,
-290,
-0,
-0,
-null,
-org.apache.royale.html.DropDownList,
-6,
-'id',
-true,
-'list',
-'x',
-true,
-200,
-'y',
-true,
-200,
-'width',
-true,
-100,
-'height',
-true,
-24,
-'beads',
-null, [org.apache.royale.binding.ConstantBinding, 4, '_id', true, '$ID13',
'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'strings',
'destinationPropertyName', true, 'dataProvider', 0, 0, null],
-0,
-1,
-'change',
+ null,
+ org.apache.royale.html.CheckBox,
+ 4,
+ 'id',
+ true,
+ 'checkbox',
+ 'x',
+ true,
+ 320,
+ 'y',
+ true,
+ 170,
+ 'text',
+ true,
+ 'Check Me',
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.RadioButton,
+ 6,
+ '_id',
+ true,
+ '$ID7',
+ 'groupName',
+ true,
+ 'group1',
+ 'text',
+ true,
+ 'Apples',
+ 'value',
+ true,
+ 0,
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 150,
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.RadioButton,
+ 7,
+ '_id',
+ true,
+ '$ID8',
+ 'groupName',
+ true,
+ 'group1',
+ 'text',
+ true,
+ 'Oranges',
+ 'value',
+ true,
+ 1,
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 170,
+ 'selected',
+ true,
+ true,
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.RadioButton,
+ 6,
+ '_id',
+ true,
+ '$ID9',
+ 'groupName',
+ true,
+ 'group1',
+ 'text',
+ true,
+ 'Grapes',
+ 'value',
+ true,
+ 2,
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 190,
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.RadioButton,
+ 7,
+ '_id',
+ true,
+ '$ID10',
+ 'groupName',
+ true,
+ 'group2',
+ 'text',
+ true,
+ 'Red',
+ 'value',
+ true,
+ 16711680,
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 250,
+ 'selected',
+ true,
+ true,
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.RadioButton,
+ 6,
+ '_id',
+ true,
+ '$ID11',
+ 'groupName',
+ true,
+ 'group2',
+ 'text',
+ true,
+ 'Green',
+ 'value',
+ true,
+ 32768,
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 270,
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.RadioButton,
+ 6,
+ '_id',
+ true,
+ '$ID12',
+ 'groupName',
+ true,
+ 'group2',
+ 'text',
+ true,
+ 'Blue',
+ 'value',
+ true,
+ 255,
+ 'x',
+ true,
+ 100,
+ 'y',
+ true,
+ 290,
+ 0,
+ 0,
+ null,
+ org.apache.royale.html.DropDownList,
+ 6,
+ 'id',
+ true,
+ 'list',
+ 'x',
+ true,
+ 200,
+ 'y',
+ true,
+ 200,
+ 'width',
+ true,
+ 100,
+ 'height',
+ true,
+ 24,
+ 'beads',
+ null,
+ [
+ org.apache.royale.binding.ConstantBinding,
+ 4,
+ '_id',
+ true,
+ '$ID13',
+ 'sourceID',
+ true,
+ 'applicationModel',
+ 'sourcePropertyName',
+ true,
+ 'strings',
+ 'destinationPropertyName',
+ true,
+ 'dataProvider',
+ 0,
+ 0,
+ null
+ ],
+ 0,
+ 1,
+ 'change',
this.$EH4,
-null,
-org.apache.royale.html.TextButton,
-4,
-'_id',
-true,
-'$ID14',
-'text',
-true,
-'OK',
-'x',
-true,
-200,
-'y',
-true,
-230,
-0,
-1,
-'click',
+ null,
+ org.apache.royale.html.TextButton,
+ 4,
+ '_id',
+ true,
+ '$ID14',
+ 'text',
+ true,
+ 'OK',
+ 'x',
+ true,
+ 200,
+ 'y',
+ true,
+ 230,
+ 0,
+ 1,
+ 'click',
this.$EH5,
-null,
-org.apache.royale.html.ComboBox,
-5,
-'id',
-true,
-'comboBox',
-'x',
-true,
-320,
-'y',
-true,
-200,
-'width',
-true,
-100,
-'beads',
-null, [org.apache.royale.binding.ConstantBinding, 4, '_id', true, '$ID15',
'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'cities',
'destinationPropertyName', true, 'dataProvider', 0, 0, null],
-0,
-1,
-'change',
+ null,
+ org.apache.royale.html.ComboBox,
+ 5,
+ 'id',
+ true,
+ 'comboBox',
+ 'x',
+ true,
+ 320,
+ 'y',
+ true,
+ 200,
+ 'width',
+ true,
+ 100,
+ 'beads',
+ null,
+ [
+ org.apache.royale.binding.ConstantBinding,
+ 4,
+ '_id',
+ true,
+ '$ID15',
+ 'sourceID',
+ true,
+ 'applicationModel',
+ 'sourcePropertyName',
+ true,
+ 'cities',
+ 'destinationPropertyName',
+ true,
+ 'dataProvider',
+ 0,
+ 0,
+ null
+ ],
+ 0,
+ 1,
+ 'change',
this.$EH6,
-null
- ];
-
- if (arr)
- this.mxmldd = arr.concat(data);
- else
- this.mxmldd = data;
- }
- return this.mxmldd;
- }
+ null
+ ];
+ if (arr)
+ this.mxmldd = arr.concat(data);
+ else
+ this.mxmldd = data;
}
+ return this.mxmldd;
}
- });
- /**
- * Metadata
- *
- * @type {Object.<string, Array.<Object>>}
- */
- MyInitialView.prototype.ROYALE_CLASS_INFO = { names: [{ name:
'MyInitialView', qName: 'MyInitialView', kind: 'class' }] };
+ }
+});
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+MyInitialView.prototype.ROYALE_CLASS_INFO = { names: [{ name: 'MyInitialView',
qName: 'MyInitialView', kind: 'class' }] };
@@ -899,5 +997,5 @@ MyInitialView.prototype.ROYALE_REFLECTION_INFO = function
() {
*/
MyInitialView.prototype.ROYALE_COMPILE_FLAGS = 9;
-
-
\ No newline at end of file
+
+
diff --git
a/compiler-jx/src/test/resources/royale/files/RoyaleTest_again_result.js
b/compiler-jx/src/test/resources/royale/files/RoyaleTest_again_result.js
index bf05d8d..78c68fb 100644
--- a/compiler-jx/src/test/resources/royale/files/RoyaleTest_again_result.js
+++ b/compiler-jx/src/test/resources/royale/files/RoyaleTest_again_result.js
@@ -101,25 +101,107 @@ RoyaleTest_again = function() {
*/
this.mxmldp;
- this.generateMXMLAttributes
- ([5,
-'model',
-false,
-[models.MyModel, 1, '_id', true, '$ID2', 0, 0, null],
-'valuesImpl',
-false,
-[org.apache.royale.core.SimpleCSSValuesImpl, 1, '_id', true, '$ID0', 0, 0,
null],
-'initialView',
-false,
-[MyInitialView, 1, '_id', true, '$ID1', 0, 0, null],
-'controller',
-false,
-[controllers.MyController, 1, '_id', true, '$ID3', 0, 0, null],
-'beads',
-null, [org.apache.royale.net.HTTPService, 2, 'id', true, 'service', 'beads',
null, [org.apache.royale.collections.LazyCollection, 3, 'id', true,
'collection', 'inputParser', false,
[org.apache.royale.collections.parsers.JSONInputParser, 1, '_id', true, '$ID4',
0, 0, null], 'itemConverter', false, [StockDataJSONItemConverter, 1, '_id',
true, '$ID5', 0, 0, null], 0, 0, null], 0, 0, null],
-0,
-1,
-'initialize',
+ this.generateMXMLAttributes([
+ 5,
+ 'model',
+ false,
+ [
+ models.MyModel,
+ 1,
+ '_id',
+ true,
+ '$ID2',
+ 0,
+ 0,
+ null
+ ],
+ 'valuesImpl',
+ false,
+ [
+ org.apache.royale.core.SimpleCSSValuesImpl,
+ 1,
+ '_id',
+ true,
+ '$ID0',
+ 0,
+ 0,
+ null
+ ],
+ 'initialView',
+ false,
+ [
+ MyInitialView,
+ 1,
+ '_id',
+ true,
+ '$ID1',
+ 0,
+ 0,
+ null
+ ],
+ 'controller',
+ false,
+ [
+ controllers.MyController,
+ 1,
+ '_id',
+ true,
+ '$ID3',
+ 0,
+ 0,
+ null
+ ],
+ 'beads',
+ null,
+ [
+ org.apache.royale.net.HTTPService,
+ 2,
+ 'id',
+ true,
+ 'service',
+ 'beads',
+ null,
+ [
+ org.apache.royale.collections.LazyCollection,
+ 3,
+ 'id',
+ true,
+ 'collection',
+ 'inputParser',
+ false,
+ [
+ org.apache.royale.collections.parsers.JSONInputParser,
+ 1,
+ '_id',
+ true,
+ '$ID4',
+ 0,
+ 0,
+ null
+ ],
+ 'itemConverter',
+ false,
+ [
+ StockDataJSONItemConverter,
+ 1,
+ '_id',
+ true,
+ '$ID5',
+ 0,
+ 0,
+ null
+ ],
+ 0,
+ 0,
+ null
+ ],
+ 0,
+ 0,
+ null
+ ],
+ 0,
+ 1,
+ 'initialize',
this.$EH0
]);