Updated Branches: refs/heads/develop cd48b0adb -> c0c0164ce
FLEX-34031 - handle itemRenderer='somepackage.someclass' Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f23f182a Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f23f182a Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f23f182a Branch: refs/heads/develop Commit: f23f182a9e8fafaa59fd56343a733f030bb5557d Parents: cd48b0a Author: Alex Harui <[email protected]> Authored: Wed Jan 8 14:46:19 2014 -0800 Committer: Alex Harui <[email protected]> Committed: Wed Jan 8 14:46:19 2014 -0800 ---------------------------------------------------------------------- .../flex/compiler/codegen/mxml/IMXMLEmitter.java | 3 +++ .../internal/codegen/mxml/MXMLBlockWalker.java | 11 +++++++++++ .../internal/codegen/mxml/MXMLEmitter.java | 16 ++++++++++++++++ .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 18 ++++++++++++++++++ .../internal/visitor/mxml/MXMLNodeSwitch.java | 5 ++++- .../compiler/visitor/mxml/IMXMLBlockVisitor.java | 3 +++ 6 files changed, 55 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f23f182a/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java index 8f78e88..566df04 100644 --- a/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java +++ b/compiler.jx/src/org/apache/flex/compiler/codegen/mxml/IMXMLEmitter.java @@ -26,6 +26,7 @@ import org.apache.flex.compiler.tree.mxml.IMXMLArrayNode; import org.apache.flex.compiler.tree.mxml.IMXMLBooleanNode; import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode; import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode; +import org.apache.flex.compiler.tree.mxml.IMXMLFactoryNode; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLIntNode; @@ -98,4 +99,6 @@ public interface IMXMLEmitter extends IEmitter void emitPropertySpecifiers(IMXMLPropertySpecifierNode[] nodes, boolean emitAttributes); + void emitFactory(IMXMLFactoryNode node); + } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f23f182a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java index d7dfabd..8aa2765 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java @@ -37,6 +37,7 @@ import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode; import org.apache.flex.compiler.tree.mxml.IMXMLDeferredInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode; import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode; +import org.apache.flex.compiler.tree.mxml.IMXMLFactoryNode; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLIntNode; @@ -342,6 +343,16 @@ public class MXMLBlockWalker implements IMXMLBlockVisitor, IMXMLBlockWalker //-------------------------------------------------------------------------- + @Override + public void visitFactory(IMXMLFactoryNode node) + { + debug("visitLiteral()"); + + mxmlEmitter.emitFactory(node); + } + + //-------------------------------------------------------------------------- + protected void debug(String message) { //System.out.println(message); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f23f182a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java index 988763f..229c27f 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLEmitter.java @@ -30,9 +30,11 @@ import org.apache.flex.compiler.tree.as.IASNode; import org.apache.flex.compiler.tree.mxml.IMXMLArrayNode; import org.apache.flex.compiler.tree.mxml.IMXMLBooleanNode; import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode; +import org.apache.flex.compiler.tree.mxml.IMXMLClassNode; import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode; import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode; import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode; +import org.apache.flex.compiler.tree.mxml.IMXMLFactoryNode; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLIntNode; @@ -328,4 +330,18 @@ public class MXMLEmitter extends Emitter implements IMXMLEmitter || node.getName().equals("mxmlContent"); } + public void emitFactory(IMXMLFactoryNode node) + { + IASNode cnode = node.getChild(0); + + write("\""); + + if (cnode instanceof IMXMLClassNode) + { + write(((IMXMLClassNode)cnode).getValue(getMXMLWalker().getProject()).getQualifiedName()); + } + + write("\""); + } + } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f23f182a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java index fc7392b..e682534 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java @@ -61,9 +61,11 @@ import org.apache.flex.compiler.tree.as.IExpressionNode; import org.apache.flex.compiler.tree.as.IImportNode; import org.apache.flex.compiler.tree.mxml.IMXMLArrayNode; import org.apache.flex.compiler.tree.mxml.IMXMLClassDefinitionNode; +import org.apache.flex.compiler.tree.mxml.IMXMLClassNode; import org.apache.flex.compiler.tree.mxml.IMXMLDataBindingNode; import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode; import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode; +import org.apache.flex.compiler.tree.mxml.IMXMLFactoryNode; import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode; import org.apache.flex.compiler.tree.mxml.IMXMLNode; @@ -1343,6 +1345,22 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements } //-------------------------------------------------------------------------- + + @Override + public void emitFactory(IMXMLFactoryNode node) + { + MXMLDescriptorSpecifier ps = getCurrentDescriptor("ps"); + ps.value = "new mx.core.ClassFactory("; + + IASNode cnode = node.getChild(0); + if (cnode instanceof IMXMLClassNode) + { + ps.value += ((IMXMLClassNode)cnode).getValue(getMXMLWalker().getProject()).getQualifiedName(); + } + ps.value += ")"; + } + + //-------------------------------------------------------------------------- // JS output //-------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f23f182a/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java b/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java index a69df1f..459518c 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java @@ -26,6 +26,7 @@ import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode; import org.apache.flex.compiler.tree.mxml.IMXMLDeferredInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode; import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode; +import org.apache.flex.compiler.tree.mxml.IMXMLFactoryNode; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLIntNode; @@ -113,6 +114,9 @@ public class MXMLNodeSwitch implements IASNodeStrategy case MXMLStateID: visitor.visitInstance((IMXMLInstanceNode) node); break; + case MXMLFactoryID: + visitor.visitFactory((IMXMLFactoryNode) node); + break; case MXMLApplicationID: case MXMLBindingID: @@ -128,7 +132,6 @@ public class MXMLNodeSwitch implements IASNodeStrategy case MXMLDesignLayerID: case MXMLEmbedID: case MXMLEffectSpecifierID: - case MXMLFactoryID: case MXMLFunctionID: case MXMLHTTPServiceID: case MXMLHTTPServiceRequestID: http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f23f182a/compiler.jx/src/org/apache/flex/compiler/visitor/mxml/IMXMLBlockVisitor.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/visitor/mxml/IMXMLBlockVisitor.java b/compiler.jx/src/org/apache/flex/compiler/visitor/mxml/IMXMLBlockVisitor.java index 4e347f0..a31124a 100644 --- a/compiler.jx/src/org/apache/flex/compiler/visitor/mxml/IMXMLBlockVisitor.java +++ b/compiler.jx/src/org/apache/flex/compiler/visitor/mxml/IMXMLBlockVisitor.java @@ -26,6 +26,7 @@ import org.apache.flex.compiler.tree.mxml.IMXMLDeclarationsNode; import org.apache.flex.compiler.tree.mxml.IMXMLDeferredInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode; import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode; +import org.apache.flex.compiler.tree.mxml.IMXMLFactoryNode; import org.apache.flex.compiler.tree.mxml.IMXMLFileNode; import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode; import org.apache.flex.compiler.tree.mxml.IMXMLIntNode; @@ -94,5 +95,7 @@ public interface IMXMLBlockVisitor extends IBlockVisitor //-------------------------------------------------------------------------- void visitLiteral(IMXMLLiteralNode node); + + void visitFactory(IMXMLFactoryNode node); }
