You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2025/09/02 17:40:41 UTC
(royale-compiler) 02/03: MXMLClassDefinitionNode: allow Model tag as child of root when using MXML 2006 dialect
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
commit 6939105b0f8825be369edd4797ccc46c586c1a00
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Sep 2 10:04:46 2025 -0700
MXMLClassDefinitionNode: allow Model tag as child of root when using MXML 2006 dialect
Moved Model child parsing from MXMLDocumentNode into MXMLClassDefinitionNode instead. This allows mx:Model to be declared in custom mx:Component tags too. This was not allowed before, but should have been. Improves consistency with Flex SDK compiler.
MXML 2009 does not allow Models to be declared as child of the root, giving an error about not implementing IUIComponent. This is true even if the root tag is fx:Object, which wouldn't have any requirement for IUIComponent. So, with MXML 2009, Models should go always into fx:Declarations, which we were not requiring before, but should have been. Further improves consistency with Flex SDK compiler.
---
.../royale/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java | 5 +++++
.../apache/royale/compiler/internal/tree/mxml/MXMLDocumentNode.java | 4 ----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java
index 990deb2e6..f8cb448cf 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java
@@ -292,6 +292,11 @@ public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase
{
childNode = new MXMLComponentNode(this);
}
+ else if (fileScope.isModelTag(childTag)
+ && builder.getMXMLDialect().isEqualToOrBefore(MXMLDialect.MXML_2006))
+ {
+ childNode = new MXMLModelNode(this);
+ }
else
{
super.processChildTag(builder, tag, childTag, info);
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLDocumentNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLDocumentNode.java
index 02f41c732..630fa29ae 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLDocumentNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLDocumentNode.java
@@ -79,10 +79,6 @@ public class MXMLDocumentNode extends MXMLClassDefinitionNode implements IMXMLDo
{
childNode = new MXMLLibraryNode(this);
}
- else if (fileScope.isModelTag(childTag))
- {
- childNode = new MXMLModelNode(this);
- }
else if (fileScope.isPrivateTag(childTag))
{
// A <Private> tag must be the last child tag.