ashikase opened a new issue, #241:
URL: https://github.com/apache/royale-compiler/issues/241
Version tested: apache-royale-0.9.12
While working on an old code base that uses a mix of Flex 3 and Flex 4
classes, I found that `<mx:Component>` tags in the Flex 3 files were being
detected as errors (specifically, `MXMLUnexpectedTagProblem`).
The compiler expects `Component` nodes at the class level to be wrapped in
an `<fx:Declarations>` node (`MXMLDeclarationsNode`), as such:
```mxml
<mx:Box
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
>
<fx:Declarations>
<fx:Component id="...">...</fx:Component>
</fx:Declarations>
</mx:Box>
```
This is correct for Flex 4, but there is no `Declarations` tag in Flex 3;
components can be written as direct children of the class:
```mxml
<mx:Box
xmlns:mx="http://ns.adobe.com/mxml/2006"
>
<mx:Component id="...">...</mx:Component>
</mx:Box>
```
I only started looking at the royale-compiler source today, so I am not very
familiar with the codebase, but my naive fix for this was to add the following
code:
```java
else if (fileScope.isComponentTag(childTag) &&
(builder.getMXMLDialect().isEqualToOrBefore(MXMLDialect.MXML_2006)))
{
childNode = new MXMLComponentNode(this);
}
```
... after [line
289](https://github.com/apache/royale-compiler/blob/658ba460b4f8362a379003c259aa2bb01307819b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java#L289)
of the `MXMLClassDefinitionNode::parseChildTag` method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]