This is an automated email from the ASF dual-hosted git repository. aharui 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 f762726 fx:Declarations after mxmlContent wasn't being emitted. Fixes #531. Also adjust name of storage name for closures f762726 is described below commit f7627268a7560878b75d3ca127ae049d6fe7a352 Author: Alex Harui <aha...@apache.org> AuthorDate: Tue Oct 29 10:13:44 2019 -0700 fx:Declarations after mxmlContent wasn't being emitted. Fixes #531. Also adjust name of storage name for closures --- .../codegen/mxml/royale/MXMLRoyaleEmitter.java | 22 +++++++++++++++++++++- .../mxml/royale/TestRoyaleMXMLApplication.java | 7 +++---- 2 files changed, 24 insertions(+), 5 deletions(-) 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 a5e4fd7..7290267 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 @@ -769,13 +769,30 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements public void emitDeclarations(IMXMLDeclarationsNode node) { inMXMLContent = true; + boolean reusingDescriptor = false; + MXMLDescriptorSpecifier currentInstance = getCurrentDescriptor("i"); MXMLDescriptorSpecifier currentPropertySpecifier = new MXMLDescriptorSpecifier(); currentPropertySpecifier.isProperty = true; currentPropertySpecifier.name = "mxmlContent"; currentPropertySpecifier.parent = currentInstance; - descriptorTree.add(currentPropertySpecifier); + if (currentInstance == null) + { + ArrayList<MXMLDescriptorSpecifier> specList = + (currentInstance == null) ? descriptorTree : currentInstance.propertySpecifiers; + for (MXMLDescriptorSpecifier ds : specList) + { + if (ds.name.equals("mxmlContent")) + { + currentPropertySpecifier = ds; + reusingDescriptor = true; + break; + } + } + } + if (!reusingDescriptor) + descriptorTree.add(currentPropertySpecifier); moveDown(false, currentInstance, currentPropertySpecifier); super.emitDeclarations(node); moveUp(false, false); @@ -2173,11 +2190,14 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements MXMLDescriptorSpecifier currentPropertySpecifier = getCurrentDescriptor("ps"); if (nodeID == ASTNodeID.MXMLFunctionID) { + RoyaleJSProject project = (RoyaleJSProject) getMXMLWalker().getProject(); + project.needLanguage = true; currentPropertySpecifier.value = JSRoyaleEmitterTokens.CLOSURE_FUNCTION_NAME.getToken() + ASEmitterTokens.PAREN_OPEN.getToken() + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.MEMBER_ACCESS.getToken() + ((MXMLFunctionNode)node).getValue((ICompilerProject) getMXMLWalker().getProject()).getBaseName() + ASEmitterTokens.COMMA.getToken() + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.THIS.getToken() + ASEmitterTokens.COMMA.getToken() + ASEmitterTokens.SPACE.getToken() + ASEmitterTokens.SINGLE_QUOTE.getToken() + + "__" + JSRoyaleEmitterTokens.CLOSURE_FUNCTION_NAME.getToken() + "__" + ((MXMLFunctionNode)node).getValue((ICompilerProject) getMXMLWalker().getProject()).getBaseName() + ASEmitterTokens.SINGLE_QUOTE.getToken() + ASEmitterTokens.PAREN_CLOSE.getToken(); return; 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 bc50492..882621f 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 @@ -1512,6 +1512,7 @@ public class TestRoyaleMXMLApplication extends RoyaleTestBase "\n" + "goog.require('org.apache.royale.core.Application');\n" + "goog.require('org.apache.royale.charts.beads.DataTipBead');\n" + +// "goog.require('org.apache.royale.utils.Language');\n" + // in real compiles this will be output, but not in tests "\n" + "\n" + "\n" + @@ -1543,7 +1544,7 @@ public class TestRoyaleMXMLApplication extends RoyaleTestBase " this.generateMXMLAttributes\n" + " ([1,\n" + "'beads',\n" + - "null, [org.apache.royale.charts.beads.DataTipBead, 2, '_id', true, '$ID0', 'labelFunction', true, this.fn_test, 0, 0, null],\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" + " ]);\n" + @@ -1584,11 +1585,9 @@ public class TestRoyaleMXMLApplication extends RoyaleTestBase " */\n" + "AppName.prototype.ROYALE_REFLECTION_INFO = function () {\n" + " return {\n" + - " variables: function () {return {};},\n" + - " accessors: function () {return {};},\n" + " methods: function () {\n" + " return {\n" + - " 'fn_test': { type: 'void', declaredBy: 'AppName', parameters: function () { return [ { index: 1, type: 'String', optional: false } ]; }},\n"+ + " 'fn_test': { type: 'void', declaredBy: 'AppName', parameters: function () { return [ 'String', false ]; }},\n"+ " 'AppName': { type: '', declaredBy: 'AppName'}\n"+ " };\n" + " }\n" +