You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2013/06/14 18:52:38 UTC

[1/3] git commit: [flex-falcon] [refs/heads/develop] - Fix states encoding

Updated Branches:
  refs/heads/develop 0d5171cab -> fac3415bb


Fix states encoding


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/e3f62b13
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/e3f62b13
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/e3f62b13

Branch: refs/heads/develop
Commit: e3f62b1376c7c5c84b053034088d8f03c478de58
Parents: 0d5171c
Author: Alex Harui <ah...@apache.org>
Authored: Tue Jun 11 23:29:22 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Jun 11 23:33:30 2013 -0700

----------------------------------------------------------------------
 .../as/codegen/MXMLClassDirectiveProcessor.java | 57 ++++++++++----------
 1 file changed, 27 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e3f62b13/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java b/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
index bebf953..a6869f6 100644
--- a/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
+++ b/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
@@ -3278,8 +3278,9 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
                 
                 context.addInstruction(OP_pushstring, propertyName);
                 
-                traverse(propertyNode, context);
+                context.isContentFactory = false;
                 
+                traverse(propertyNode, context);
                 
                 context.stopUsing(IL.PROPERTIES, 1);
             }
@@ -4057,14 +4058,16 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
         Integer index = nodeToIndexMap.get(instanceNode);
         assert index != null;
         
+        InstructionList addItemsIL = new InstructionList();
+        int addItemsCounter = 0;
         if (getProject().getTargetSettings().getMxmlChildrenAsData())
         {
-            context.startUsing(IL.MXML_ADD_ITEMS_PROPERTIES);
-            context.addInstruction(OP_pushstring, "itemsDescriptor");
-            context.addInstruction(OP_pushtrue);  // the value is an array of descriptor data that will be parsed later
+            
+            addItemsIL.addInstruction(OP_pushstring, "itemsDescriptor");
+            addItemsIL.addInstruction(OP_pushtrue);  // the value is an array of descriptor data that will be parsed later
             InstructionList il = nodeToInstanceDescriptorMap.get(instanceNode);
-            context.addAll(il);
-            context.stopUsing(IL.MXML_ADD_ITEMS_PROPERTIES, 1);
+            addItemsIL.addAll(il);
+            addItemsCounter++;
         }
         else
         {
@@ -4106,14 +4109,13 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
                
                if (getProject().getTargetSettings().getMxmlChildrenAsData())
                {
-                   context.startUsing(IL.MXML_ADD_ITEMS_PROPERTIES);
-                   context.addInstruction(OP_pushstring, "destination");
-                   context.addInstruction(OP_pushtrue); // simple type
-                   context.addInstruction(OP_pushstring, parentId); 
-                   context.addInstruction(OP_pushstring, "propertyName");
-                   context.addInstruction(OP_pushtrue); // simple type
-                   context.addInstruction(OP_pushstring, propName); 
-                   context.stopUsing(IL.MXML_ADD_ITEMS_PROPERTIES, 2);
+                   addItemsIL.addInstruction(OP_pushstring, "destination");
+                   addItemsIL.addInstruction(OP_pushtrue); // simple type
+                   addItemsIL.addInstruction(OP_pushstring, parentId); 
+                   addItemsIL.addInstruction(OP_pushstring, "propertyName");
+                   addItemsIL.addInstruction(OP_pushtrue); // simple type
+                   addItemsIL.addInstruction(OP_pushstring, propName); 
+                   addItemsCounter += 2;
                }
                else
                {
@@ -4164,11 +4166,10 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
         if (getProject().getTargetSettings().getMxmlChildrenAsData())
         {
             // position
-            context.startUsing(IL.MXML_ADD_ITEMS_PROPERTIES);
-            context.addInstruction(OP_pushstring, "position");
-            context.addInstruction(OP_pushtrue);
-            context.addInstruction(OP_pushstring, positionPropertyValue); 
-            context.stopUsing(IL.MXML_ADD_ITEMS_PROPERTIES, 1);
+            addItemsIL.addInstruction(OP_pushstring, "position");
+            addItemsIL.addInstruction(OP_pushtrue);
+            addItemsIL.addInstruction(OP_pushstring, positionPropertyValue); 
+            addItemsCounter++;
         }
         else
         {
@@ -4185,11 +4186,10 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
             if (getProject().getTargetSettings().getMxmlChildrenAsData())
             {
                 // position
-                context.startUsing(IL.MXML_ADD_ITEMS_PROPERTIES);
-                context.addInstruction(OP_pushstring, "relativeTo");
-                context.addInstruction(OP_pushtrue);
-                context.addInstruction(OP_pushstring, relativeToPropertyValue); 
-                context.stopUsing(IL.MXML_ADD_ITEMS_PROPERTIES, 1);
+                addItemsIL.addInstruction(OP_pushstring, "relativeTo");
+                addItemsIL.addInstruction(OP_pushtrue);
+                addItemsIL.addInstruction(OP_pushstring, relativeToPropertyValue); 
+                addItemsCounter++;
             }
             else
             {
@@ -4200,17 +4200,14 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
         }
         if (getProject().getTargetSettings().getMxmlChildrenAsData())
         {
-            context.pushNumericConstant(context.getCounter(IL.MXML_ADD_ITEMS_PROPERTIES));
-            context.startUsing(IL.MXML_ADD_ITEMS_PROPERTIES);
-            InstructionList il = context.currentInstructionList;
-            context.stopUsing(IL.MXML_ADD_ITEMS_PROPERTIES, 0);
-            context.addAll(il);
+            context.pushNumericConstant(addItemsCounter);
+            context.addAll(addItemsIL);
             context.pushNumericConstant(0); // styles
             context.pushNumericConstant(0); // effects
             context.pushNumericConstant(0); // events
             context.addInstruction(OP_pushnull); // children
             // we add 6: one for the addItems class def, and one each for the count of properties, styles, effect, children
-            context.incrementCounter(IL.MXML_OVERRIDE_PROPERTIES, context.getCounter(IL.MXML_ADD_ITEMS_PROPERTIES) * 3 + 6);      
+            context.incrementCounter(IL.MXML_OVERRIDE_PROPERTIES, addItemsCounter * 3 + 6);      
         }
     }
      


[3/3] git commit: [flex-falcon] [refs/heads/develop] - changes needed to support states in JS

Posted by ah...@apache.org.
changes needed to support states in JS


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/fac3415b
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/fac3415b
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/fac3415b

Branch: refs/heads/develop
Commit: fac3415bb751ba995cd2dfcda800a3467e0acedd
Parents: 6077689
Author: Alex Harui <ah...@apache.org>
Authored: Thu Jun 13 23:08:26 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Jun 13 23:08:26 2013 -0700

----------------------------------------------------------------------
 .../js/flexjs/TestFlexJSExpressions.java        | 105 ++++--
 .../flexjs/files/FlexJSTest_again_result.js     |   6 +-
 .../flexjs/files/MyInitialView_result.js        |  64 ++--
 .../codegen/js/flexjs/JSFlexJSEmitter.java      |  35 +-
 .../mxml/flexjs/MXMLDescriptorSpecifier.java    |  33 +-
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 352 +++++++++++++++++++
 .../internal/projects/FlexJSProject.java        |   3 +
 .../as/codegen/GlobalDirectiveProcessor.java    |   2 +
 .../as/codegen/MXMLClassDirectiveProcessor.java |   2 +-
 .../tree/mxml/MXMLClassDefinitionNode.java      |   2 +-
 .../internal/tree/mxml/MXMLDocumentNode.java    |   3 +
 11 files changed, 515 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index da33a4a..96ba5fa 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -30,7 +30,6 @@ import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IClassNode;
 import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
-import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
 import org.junit.Test;
 
 /**
@@ -41,38 +40,6 @@ public class TestFlexJSExpressions extends TestGoogExpressions
 
     @Override
     @Test
-    public void testVisitLanguageIdentifierNode_This()
-    {
-        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
-                "if (a) this.a;", IMemberAccessExpressionNode.class);
-        asBlockWalker.visitMemberAccessExpression(node);
-        assertOut("a");
-    }
-
-    @Override
-    @Test
-    public void testVisitLanguageIdentifierNode_This1()
-    {
-        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
-                "if (a) this.a;", IMemberAccessExpressionNode.class);
-
-        asBlockWalker.visitMemberAccessExpression(node);
-        assertOut("a");
-    }
-
-    @Override
-    @Test
-    public void testVisitLanguageIdentifierNode_This2()
-    {
-        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getNode(
-                "if (a) this.a;", IMemberAccessExpressionNode.class);
-
-        asBlockWalker.visitMemberAccessExpression(node);
-        assertOut("a");
-    }
-
-    @Override
-    @Test
     public void testVisitLanguageIdentifierNode_SuperMethod_1()
     {
         IFunctionNode node = getMethod("function foo(){if (a) super.foo();}");
@@ -166,6 +133,54 @@ public class TestFlexJSExpressions extends TestGoogExpressions
     }
 
     @Test
+    public void testVisitBinaryOperatorNode_setterAssignmentWithThisMXML()
+    {
+        // simulate MXML script conditions.
+        // get class def
+        // disconnect fileNode from parent
+        // set thisclass on emitter to class def
+        IFileNode node = (IFileNode) getNode(
+                "public class B { public function c() { this.b = 1; }; public function set b(value:int):void {}}",
+                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
+        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+                node, IFunctionNode.class);
+        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+                node, IClassNode.class);
+        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
+                fnode, IBinaryOperatorNode.class);
+        ((NodeBase)fnode).setParent(null);
+        IDefinition def = classnode.getDefinition();
+
+        ((JSFlexJSEmitter)asEmitter).thisClass = def;
+        asBlockWalker.visitBinaryOperator(bnode);
+        assertOut("this.set_b(1)");
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_setterAssignmentMXML()
+    {
+        // simulate MXML script conditions.
+        // get class def
+        // disconnect fileNode from parent
+        // set thisclass on emitter to class def
+        IFileNode node = (IFileNode) getNode(
+                "public class B { public function c() { b = 1; }; public function set b(value:int):void {}}",
+                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
+        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+                node, IFunctionNode.class);
+        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+                node, IClassNode.class);
+        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
+                fnode, IBinaryOperatorNode.class);
+        ((NodeBase)fnode).setParent(null);
+        IDefinition def = classnode.getDefinition();
+
+        ((JSFlexJSEmitter)asEmitter).thisClass = def;
+        asBlockWalker.visitBinaryOperator(bnode);
+        assertOut("this.set_b(1)");
+    }
+
+    @Test
     public void testVisitBinaryOperatorNode_setterAssignmentOtherInstance()
     {
         IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(
@@ -432,6 +447,30 @@ public class TestFlexJSExpressions extends TestGoogExpressions
     }
 
     @Test
+    public void testVisitBinaryOperatorNode_staticSetterAssignmentOtherInstanceMXML()
+    {
+        // simulate MXML script conditions.
+        // get class def
+        // disconnect fileNode from parent
+        // set thisclass on emitter to class def
+        IFileNode node = (IFileNode) getNode(
+                "public class B {public function c() { d.b = 1; }; public function set b(value:int):void {}; public static function get d():B {}}",
+                IFileNode.class, WRAP_LEVEL_PACKAGE, true);
+        IFunctionNode fnode = (IFunctionNode) findFirstDescendantOfType(
+                node, IFunctionNode.class);
+        IClassNode classnode = (IClassNode) findFirstDescendantOfType(
+                node, IClassNode.class);
+        IBinaryOperatorNode bnode = (IBinaryOperatorNode) findFirstDescendantOfType(
+                fnode, IBinaryOperatorNode.class);
+        ((NodeBase)fnode).setParent(null);
+        IDefinition def = classnode.getDefinition();
+
+        ((JSFlexJSEmitter)asEmitter).thisClass = def;
+        asBlockWalker.visitBinaryOperator(bnode);
+        assertOut("foo.bar.B.get_d().set_b(1)");
+    }
+
+    @Test
     public void testVisitBinaryOperatorNode_staticSetterAssignmentFromGetter()
     {
         IFunctionNode node = (IFunctionNode) getNode(

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js b/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
index dc592ed..f29d279 100644
--- a/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
@@ -58,13 +58,13 @@ FlexJSTest_again = function() {
 	 * @private
 	 * @type {org.apache.flex.net.JSONInputParser}
 	 */
-	this.$ID4;
+	this.$ID6;
 	
 	/**
 	 * @private
 	 * @type {StockDataJSONItemConverter}
 	 */
-	this.$ID5;
+	this.$ID7;
 	
 	/**
 	 * @private
@@ -159,7 +159,7 @@ false,
 false,
 [controllers.MyController, 1, '_id', true, '$ID3', 0, 0, null],
 'beads',
-null, [org.apache.flex.net.HTTPService, 2, 'id', true, 'service', 'beads', null, [org.apache.flex.net.dataConverters.LazyCollection, 3, 'id', true, 'collection', 'inputParser', false, [org.apache.flex.net.JSONInputParser, 1, '_id', true, '$ID4', 0, 0, null], 'itemConverter', false, [StockDataJSONItemConverter, 1, '_id', true, '$ID5', 0, 0, null], 0, 0, null], 0, 0, null],
+null, [org.apache.flex.net.HTTPService, 2, 'id', true, 'service', 'beads', null, [org.apache.flex.net.dataConverters.LazyCollection, 3, 'id', true, 'collection', 'inputParser', false, [org.apache.flex.net.JSONInputParser, 1, '_id', true, '$ID6', 0, 0, null], 'itemConverter', false, [StockDataJSONItemConverter, 1, '_id', true, '$ID7', 0, 0, null], 0, 0, null], 0, 0, null],
 0,
 1,
 'initialize',

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
index 510cf7c..1f4462a 100644
--- a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
@@ -33,19 +33,19 @@ MyInitialView = function() {
 	 * @private
 	 * @type {org.apache.flex.binding.SimpleBinding}
 	 */
-	this.$ID0;
+	this.$ID1;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.TextButton}
 	 */
-	this.$ID1;
+	this.$ID2;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.TextButton}
 	 */
-	this.$ID2;
+	this.$ID3;
 	
 	/**
 	 * @private
@@ -63,19 +63,19 @@ MyInitialView = function() {
 	 * @private
 	 * @type {org.apache.flex.binding.ConstantBinding}
 	 */
-	this.$ID3;
+	this.$ID5;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.TextArea}
 	 */
-	this.$ID4;
+	this.$ID8;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.binding.SimpleBinding}
 	 */
-	this.$ID5;
+	this.$ID7;
 	
 	/**
 	 * @private
@@ -87,7 +87,7 @@ MyInitialView = function() {
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.TextButton}
 	 */
-	this.$ID6;
+	this.$ID9;
 	
 	/**
 	 * @private
@@ -99,37 +99,37 @@ MyInitialView = function() {
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.RadioButton}
 	 */
-	this.$ID7;
+	this.$ID10;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.RadioButton}
 	 */
-	this.$ID8;
+	this.$ID11;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.RadioButton}
 	 */
-	this.$ID9;
+	this.$ID12;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.RadioButton}
 	 */
-	this.$ID10;
+	this.$ID13;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.RadioButton}
 	 */
-	this.$ID11;
+	this.$ID14;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.RadioButton}
 	 */
-	this.$ID12;
+	this.$ID15;
 	
 	/**
 	 * @private
@@ -141,13 +141,13 @@ MyInitialView = function() {
 	 * @private
 	 * @type {org.apache.flex.binding.ConstantBinding}
 	 */
-	this.$ID13;
+	this.$ID17;
 	
 	/**
 	 * @private
 	 * @type {org.apache.flex.html.staticControls.TextButton}
 	 */
-	this.$ID14;
+	this.$ID18;
 	
 	/**
 	 * @private
@@ -159,7 +159,7 @@ MyInitialView = function() {
 	 * @private
 	 * @type {org.apache.flex.binding.ConstantBinding}
 	 */
-	this.$ID15;
+	this.$ID20;
 	
 	/**
 	 * @private
@@ -474,7 +474,7 @@ true,
 true,
 100,
 'beads',
-null, [org.apache.flex.binding.SimpleBinding, 5, '_id', true, '$ID0', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'labelText', 'eventName', true, 'labelTextChanged', 'destinationPropertyName', true, 'text', 0, 0, null],
+null, [org.apache.flex.binding.SimpleBinding, 5, '_id', true, '$ID1', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'labelText', 'eventName', true, 'labelTextChanged', 'destinationPropertyName', true, 'text', 0, 0, null],
 0,
 0,
 null,
@@ -482,7 +482,7 @@ org.apache.flex.html.staticControls.TextButton,
 4,
 '_id',
 true,
-'$ID1',
+'$ID2',
 'text',
 true,
 'Let\'s Start Timer',
@@ -501,7 +501,7 @@ org.apache.flex.html.staticControls.TextButton,
 4,
 '_id',
 true,
-'$ID2',
+'$ID3',
 'text',
 true,
 'Stop Timer',
@@ -548,7 +548,7 @@ true,
 true,
 200,
 'beads',
-null, [org.apache.flex.binding.ConstantBinding, 4, '_id', true, '$ID3', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'cities', 'destinationPropertyName', true, 'dataProvider', 0, 0, null],
+null, [org.apache.flex.binding.ConstantBinding, 4, '_id', true, '$ID5', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'cities', 'destinationPropertyName', true, 'dataProvider', 0, 0, null],
 0,
 1,
 'change',
@@ -558,7 +558,7 @@ org.apache.flex.html.staticControls.TextArea,
 6,
 '_id',
 true,
-'$ID4',
+'$ID8',
 'height',
 true,
 75,
@@ -572,7 +572,7 @@ true,
 true,
 320,
 'beads',
-null, [org.apache.flex.binding.SimpleBinding, 5, '_id', true, '$ID5', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'labelText', 'eventName', true, 'labelTextChanged', 'destinationPropertyName', true, 'text', 0, 0, null],
+null, [org.apache.flex.binding.SimpleBinding, 5, '_id', true, '$ID7', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'labelText', 'eventName', true, 'labelTextChanged', 'destinationPropertyName', true, 'text', 0, 0, null],
 0,
 0,
 null,
@@ -594,7 +594,7 @@ org.apache.flex.html.staticControls.TextButton,
 4,
 '_id',
 true,
-'$ID6',
+'$ID9',
 'text',
 true,
 'Transfer',
@@ -630,7 +630,7 @@ org.apache.flex.html.staticControls.RadioButton,
 6,
 '_id',
 true,
-'$ID7',
+'$ID10',
 'text',
 true,
 'Apples',
@@ -653,7 +653,7 @@ org.apache.flex.html.staticControls.RadioButton,
 7,
 '_id',
 true,
-'$ID8',
+'$ID11',
 'selected',
 true,
 true,
@@ -679,7 +679,7 @@ org.apache.flex.html.staticControls.RadioButton,
 6,
 '_id',
 true,
-'$ID9',
+'$ID12',
 'text',
 true,
 'Grapes',
@@ -702,7 +702,7 @@ org.apache.flex.html.staticControls.RadioButton,
 7,
 '_id',
 true,
-'$ID10',
+'$ID13',
 'selected',
 true,
 true,
@@ -728,7 +728,7 @@ org.apache.flex.html.staticControls.RadioButton,
 6,
 '_id',
 true,
-'$ID11',
+'$ID14',
 'text',
 true,
 'Green',
@@ -751,7 +751,7 @@ org.apache.flex.html.staticControls.RadioButton,
 6,
 '_id',
 true,
-'$ID12',
+'$ID15',
 'text',
 true,
 'Blue',
@@ -788,7 +788,7 @@ true,
 true,
 200,
 'beads',
-null, [org.apache.flex.binding.ConstantBinding, 4, '_id', true, '$ID13', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'strings', 'destinationPropertyName', true, 'dataProvider', 0, 0, null],
+null, [org.apache.flex.binding.ConstantBinding, 4, '_id', true, '$ID17', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'strings', 'destinationPropertyName', true, 'dataProvider', 0, 0, null],
 0,
 1,
 'change',
@@ -798,7 +798,7 @@ org.apache.flex.html.staticControls.TextButton,
 4,
 '_id',
 true,
-'$ID14',
+'$ID18',
 'text',
 true,
 'OK',
@@ -828,7 +828,7 @@ true,
 true,
 320,
 'beads',
-null, [org.apache.flex.binding.ConstantBinding, 4, '_id', true, '$ID15', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'cities', 'destinationPropertyName', true, 'dataProvider', 0, 0, null],
+null, [org.apache.flex.binding.ConstantBinding, 4, '_id', true, '$ID20', 'sourceID', true, 'applicationModel', 'sourcePropertyName', true, 'cities', 'destinationPropertyName', true, 'dataProvider', 0, 0, null],
 0,
 1,
 'change',

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 1bcfe83..f5ae7eb 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -292,6 +292,18 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                 return parentNodeId == ASTNodeID.ContainerID
                         || !(parentNode instanceof ParameterNode);
             }
+            else if (nodeDef instanceof AccessorDefinition)
+            {
+                IDefinition pdef = ((AccessorDefinition) nodeDef).getParent();
+
+                if (thisClass == null || !isSameClass(pdef, thisClass, project))
+                    return false;
+
+                if (identifierIsMemberAccess)
+                    return node == firstChild;
+
+                return true;
+            }
             else if (parentNodeId == ASTNodeID.ContainerID
                     && nodeDef instanceof FunctionDefinition)
             {
@@ -313,10 +325,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             {
                 if (identifierIsMemberAccess)
                 {
-                    boolean parentIsThis = firstChild instanceof ILanguageIdentifierNode
-                            && ((ILanguageIdentifierNode) firstChild).getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.THIS;
-
-                    return node == firstChild || parentIsThis;
+                    return node == firstChild;
                 }
                 else
                 {
@@ -666,12 +675,20 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         if (def != null && def.isStatic())
             isStatic = true;
 
-        if (!isStatic
-                && !(leftNode instanceof ILanguageIdentifierNode && ((ILanguageIdentifierNode) leftNode)
-                        .getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.THIS))
+        if (!isStatic)
         {
-            getWalker().walk(node.getLeftOperandNode());
-            write(node.getOperator().getOperatorText());
+            if (!(leftNode instanceof ILanguageIdentifierNode && ((ILanguageIdentifierNode) leftNode)
+                        .getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.THIS))
+            {
+                getWalker().walk(node.getLeftOperandNode());
+                write(node.getOperator().getOperatorText());
+            }
+            else
+            {
+                write(ASEmitterTokens.THIS);
+                write(node.getOperator().getOperatorText());
+            }
+        
         }
         getWalker().walk(node.getRightOperandNode());
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java
index 82886f9..d70ac27 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLDescriptorSpecifier.java
@@ -171,19 +171,26 @@ public class MXMLDescriptorSpecifier extends MXMLNodeSpecifier
                 }
             }
 
-            write(propertySpecifiers.size() + 1 + "");
-            writeDelimiter(writeNewline);
-
-            String idPropName = (id
-                    .startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX.getToken())) ? "_id"
-                    : "id";
-            writeSimpleDescriptor(idPropName, ASEmitterTokens.TRUE.getToken(),
-                    ASEmitterTokens.SINGLE_QUOTE.getToken()
-                            + id + ASEmitterTokens.SINGLE_QUOTE.getToken(),
-                    writeNewline);
-
-            writeDelimiter(writeNewline);
-
+            if (id != null)
+            {
+                write(propertySpecifiers.size() + 1 + "");
+                writeDelimiter(writeNewline);
+                String idPropName = (id
+                        .startsWith(MXMLFlexJSEmitterTokens.ID_PREFIX.getToken())) ? "_id"
+                        : "id";
+                writeSimpleDescriptor(idPropName, ASEmitterTokens.TRUE.getToken(),
+                        ASEmitterTokens.SINGLE_QUOTE.getToken()
+                                + id + ASEmitterTokens.SINGLE_QUOTE.getToken(),
+                        writeNewline);
+    
+                writeDelimiter(writeNewline);
+            }
+            else
+            {
+                write(propertySpecifiers.size() + "");
+                writeDelimiter(writeNewline);
+            }
+            
             output(writeNewline);
         }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/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 45c5c90..c58724d 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
@@ -21,7 +21,10 @@ package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
 
 import java.io.FilterWriter;
 import java.util.ArrayList;
+import java.util.List;
 
+import org.apache.flex.abc.semantics.Name;
+import org.apache.flex.abc.semantics.Namespace;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
 import org.apache.flex.compiler.definitions.IClassDefinition;
@@ -31,17 +34,24 @@ import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.mxml.MXMLEmitter;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.scopes.ASProjectScope;
+import org.apache.flex.compiler.internal.tree.mxml.MXMLDocumentNode;
 import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
 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.IMXMLDocumentNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLEventSpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLInstanceNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLLiteralNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLSpecifierNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLStateNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStyleSpecifierNode;
 import org.apache.flex.compiler.units.ICompilationUnit;
@@ -68,6 +78,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     private int idCounter;
 
     private boolean inMXMLContent;
+    private boolean inStatesOverride;
 
     public MXMLFlexJSEmitter(FilterWriter out)
     {
@@ -424,6 +435,9 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     @Override
     public void emitInstance(IMXMLInstanceNode node)
     {
+        if (isStateDependent(node) && !inStatesOverride)
+            return;
+        
         IClassDefinition cdef = node
                 .getClassReference((ICompilerProject) getMXMLWalker()
                         .getProject());
@@ -432,6 +446,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
         String id = node.getID();
         if (id == null)
+            id = node.getEffectiveID();
+        if (id == null)
             id = MXMLFlexJSEmitterTokens.ID_PREFIX.getToken() + idCounter++;
 
         MXMLDescriptorSpecifier currentInstance = new MXMLDescriptorSpecifier();
@@ -464,6 +480,68 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
             moveUp(false, true);
         }
+        else if (node instanceof IMXMLStateNode)
+        {
+            IMXMLStateNode stateNode = (IMXMLStateNode)node;
+            String name = stateNode.getStateName();
+            if (name != null)
+            {
+                MXMLDescriptorSpecifier stateName = new MXMLDescriptorSpecifier();
+                stateName.isProperty = true;
+                stateName.id = id;
+                stateName.name = "name";
+                stateName.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + name + ASEmitterTokens.SINGLE_QUOTE.getToken();
+                stateName.parent = currentInstance;
+                currentInstance.propertySpecifiers.add(stateName);
+            }
+            MXMLDescriptorSpecifier overrides = new MXMLDescriptorSpecifier();
+            overrides.isProperty = true;
+            overrides.hasArray = true;
+            overrides.id = id;
+            overrides.name = "overrides";
+            overrides.parent = currentInstance;
+            currentInstance.propertySpecifiers.add(overrides);
+            moveDown(false, null, overrides);
+
+            IMXMLClassDefinitionNode classDefinitionNode = stateNode.getClassDefinitionNode();
+            List<IMXMLNode> snodes = classDefinitionNode.getNodesDependentOnState(stateNode.getStateName());
+            if (snodes != null)
+            {
+                for (int i=snodes.size()-1; i>=0; --i)
+                {
+                    IMXMLNode inode = snodes.get(i);
+                    if (inode.getNodeID() == ASTNodeID.MXMLInstanceID)
+                    {
+                        emitInstanceOverride((IMXMLInstanceNode)inode);
+                    }
+                }
+                // Next process the non-instance overrides dependent on this state.
+                // Each one will generate code to push an IOverride instance.
+                for (IMXMLNode anode : snodes)
+                {
+                    switch (anode.getNodeID())
+                    {
+                        case MXMLPropertySpecifierID:
+                        {
+                            emitPropertyOverride((IMXMLPropertySpecifierNode)anode);
+                            break;
+                        }
+                        case MXMLStyleSpecifierID:
+                        {
+                            emitStyleOverride((IMXMLStyleSpecifierNode)node);
+                            break;
+                        }
+                        case MXMLEventSpecifierID:
+                        {
+                            emitEventOverride((IMXMLEventSpecifierNode)node);
+                            break;
+                        }
+                    }
+                }
+            }
+            
+            moveUp(false, false);
+        }
 
         IMXMLEventSpecifierNode[] enodes = node.getEventSpecifierNodes();
         if (enodes != null)
@@ -479,6 +557,280 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         }
     }
 
+    public void emitPropertyOverride(IMXMLPropertySpecifierNode propertyNode)
+    {
+        FlexProject project = (FlexProject) getMXMLWalker().getProject();
+        Name propertyOverride = project.getPropertyOverrideClassName();
+        emitPropertyOrStyleOverride(propertyOverride, propertyNode);
+    }
+    
+    /**
+     * Generates instructions in the current context
+     * to create an instance of mx.states.SetStyle
+     * with its <code>target</code>, <code>name</code>,
+     * and <code>value</code> properties set.
+     */
+    void emitStyleOverride(IMXMLStyleSpecifierNode styleNode)
+    {
+        FlexProject project = (FlexProject) getMXMLWalker().getProject();
+        Name styleOverride = project.getStyleOverrideClassName();
+        emitPropertyOrStyleOverride(styleOverride, styleNode);
+    }
+    
+    void emitPropertyOrStyleOverride(Name overrideName, IMXMLPropertySpecifierNode propertyOrStyleNode)
+    {
+        MXMLDescriptorSpecifier currentInstance = getCurrentDescriptor("ps");
+        IASNode parentNode = propertyOrStyleNode.getParent();
+        String id = parentNode instanceof IMXMLInstanceNode ?
+                    ((IMXMLInstanceNode)parentNode).getEffectiveID() :
+                    "";
+        
+        String name = propertyOrStyleNode.getName();        
+        
+        IMXMLInstanceNode propertyOrStyleValueNode = propertyOrStyleNode.getInstanceNode();
+        
+        MXMLDescriptorSpecifier setProp = new MXMLDescriptorSpecifier();
+        setProp.isProperty = false;
+        setProp.name = nameToString(overrideName);
+        setProp.parent = currentInstance;
+        currentInstance.propertySpecifiers.add(setProp);
+            // Set its 'target' property to the id of the object
+            // whose property or style this override will set.
+        MXMLDescriptorSpecifier target = new MXMLDescriptorSpecifier();
+        target.isProperty = true;
+        target.name = "target";
+        target.parent = setProp;
+        target.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + id + ASEmitterTokens.SINGLE_QUOTE.getToken();
+        setProp.propertySpecifiers.add(target);
+
+            // Set its 'name' property to the name of the property or style.
+        MXMLDescriptorSpecifier pname = new MXMLDescriptorSpecifier();
+        pname.isProperty = true;
+        pname.name = "name";
+        pname.parent = setProp;
+        pname.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + name + ASEmitterTokens.SINGLE_QUOTE.getToken();
+        setProp.propertySpecifiers.add(pname);
+
+            // Set its 'value' property to the value of the property or style.
+        MXMLDescriptorSpecifier value = new MXMLDescriptorSpecifier();
+        value.isProperty = true;
+        value.name = "value";
+        value.parent = setProp;
+        setProp.propertySpecifiers.add(value);
+        moveDown(false, null, value);
+        getMXMLWalker().walk(propertyOrStyleValueNode); // instance node
+        moveUp(false, false);
+    }
+        
+    /**
+     * Generates instructions in the current context
+     * to create an instance of mx.states.SetEventHandler
+     * with its <code>target</code>, <code>name</code>,
+     * and <code>handlerFunction</code> properties set.
+     */
+    void emitEventOverride(IMXMLEventSpecifierNode eventNode)
+    {
+        MXMLDescriptorSpecifier currentInstance = getCurrentDescriptor("ps");
+        FlexProject project = (FlexProject) getMXMLWalker().getProject();
+        Name eventOverride = project.getEventOverrideClassName();
+        
+        IASNode parentNode = eventNode.getParent();
+        String id = parentNode instanceof IMXMLInstanceNode ?
+                    ((IMXMLInstanceNode)parentNode).getEffectiveID() :
+                    "";
+        
+        String name = eventNode.getName();
+        
+        MXMLDocumentNode doc = (MXMLDocumentNode)eventNode.getAncestorOfType(MXMLDocumentNode.class);
+
+        Name eventHandler = doc.cdp.getEventHandlerName(eventNode);
+
+        MXMLDescriptorSpecifier setEvent = new MXMLDescriptorSpecifier();
+        setEvent.isProperty = true;
+        setEvent.name = nameToString(eventOverride);
+        setEvent.parent = currentInstance;
+        currentInstance.propertySpecifiers.add(setEvent);
+        // Set its 'target' property to the id of the object
+        // whose event this override will set.
+        MXMLDescriptorSpecifier target = new MXMLDescriptorSpecifier();
+        target.isProperty = true;
+        target.name = "target";
+        target.parent = setEvent;
+        target.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + id + ASEmitterTokens.SINGLE_QUOTE.getToken();
+        setEvent.propertySpecifiers.add(target);
+
+        // Set its 'name' property to the name of the property or style.
+        MXMLDescriptorSpecifier pname = new MXMLDescriptorSpecifier();
+        pname.isProperty = true;
+        pname.name = "name";
+        pname.parent = setEvent;
+        pname.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + name + ASEmitterTokens.SINGLE_QUOTE.getToken();
+        setEvent.propertySpecifiers.add(pname);
+        
+        // Set its 'handlerFunction' property to the autogenerated event handler.
+        MXMLDescriptorSpecifier handler = new MXMLDescriptorSpecifier();
+        handler.isProperty = false;
+        handler.name = "handlerFunction";
+        handler.parent = setEvent;
+        handler.value = eventHandler.toString();
+        setEvent.propertySpecifiers.add(handler);
+        
+    }
+
+    public void emitInstanceOverride(IMXMLInstanceNode instanceNode)
+    {
+        inStatesOverride = true;
+        
+        MXMLDescriptorSpecifier currentInstance = getCurrentDescriptor("ps");
+        FlexProject project = (FlexProject) getMXMLWalker().getProject();
+        Name instanceOverrideName = project.getInstanceOverrideClassName();
+
+        MXMLDescriptorSpecifier addItems = new MXMLDescriptorSpecifier();
+        addItems.isProperty = false;
+        addItems.name = nameToString(instanceOverrideName);
+        addItems.parent = currentInstance;
+        currentInstance.propertySpecifiers.add(addItems);
+        MXMLDescriptorSpecifier itemsDesc = new MXMLDescriptorSpecifier();
+        itemsDesc.isProperty = true;
+        itemsDesc.hasArray = true;
+        itemsDesc.name = "itemsDescriptor";
+        itemsDesc.parent = addItems;
+        addItems.propertySpecifiers.add(itemsDesc);
+        boolean oldInMXMLContent = inMXMLContent;
+        moveDown(false, null, itemsDesc);
+        inMXMLContent = true;
+        getMXMLWalker().walk(instanceNode); // instance node
+        inMXMLContent = oldInMXMLContent;
+        moveUp(false, false);
+        
+        //-----------------------------------------------------------------------------
+        // Second property set: maybe set destination and propertyName
+        
+        // get the property specifier node for the property the instanceNode represents
+        IMXMLPropertySpecifierNode propertySpecifier = (IMXMLPropertySpecifierNode) 
+            instanceNode.getAncestorOfType( IMXMLPropertySpecifierNode.class);
+    
+        if (propertySpecifier == null)
+        {
+           assert false;        // I think this indicates an invalid tree...
+        }
+        else
+        {
+            // Check the parent - if it's an instance then we want to use these
+            // nodes to get our property values from. If not, then it's the root
+            // and we don't need to specify destination
+            
+            IASNode parent = propertySpecifier.getParent();
+            if (parent instanceof IMXMLInstanceNode)
+            {
+               IMXMLInstanceNode parentInstance = (IMXMLInstanceNode)parent;
+               String parentId = parentInstance.getEffectiveID();
+               assert parentId != null;
+               String propName = propertySpecifier.getName();
+               
+               MXMLDescriptorSpecifier dest = new MXMLDescriptorSpecifier();
+               dest.isProperty = true;
+               dest.name = "destination";
+               dest.parent = addItems;
+               dest.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + parentId + ASEmitterTokens.SINGLE_QUOTE.getToken();
+               addItems.propertySpecifiers.add(dest);
+
+               MXMLDescriptorSpecifier prop = new MXMLDescriptorSpecifier();
+               prop.isProperty = true;
+               prop.name = "propertyName";
+               prop.parent = addItems;
+               prop.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + propName + ASEmitterTokens.SINGLE_QUOTE.getToken();
+               addItems.propertySpecifiers.add(prop);
+            }
+        }  
+        
+        //---------------------------------------------------------------
+        // Third property set: position and relativeTo
+        String positionPropertyValue = null;
+        String relativeToPropertyValue = null;
+       
+        // look to see if we have any sibling nodes that are not state dependent
+        // that come BEFORE us
+        IASNode instanceParent = instanceNode.getParent();
+        IASNode prevStatelessSibling=null;
+        for (int i=0; i< instanceParent.getChildCount(); ++i)
+        {
+            IASNode sib = instanceParent.getChild(i);
+            assert sib instanceof IMXMLInstanceNode;    // surely our siblings are also instances?
+           
+            // stop looking for previous nodes when we find ourself
+            if (sib == instanceNode)
+                break;
+
+            if (!isStateDependent(sib))
+            {
+                prevStatelessSibling = sib;
+            }
+        }
+        
+        if (prevStatelessSibling == null) {
+            positionPropertyValue = "first";        // TODO: these should be named constants
+        }
+        else {
+            positionPropertyValue = "after";
+            relativeToPropertyValue = ((IMXMLInstanceNode)prevStatelessSibling).getEffectiveID();
+        }
+       
+        MXMLDescriptorSpecifier pos = new MXMLDescriptorSpecifier();
+        pos.isProperty = true;
+        pos.name = "position";
+        pos.parent = addItems;
+        pos.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + positionPropertyValue + ASEmitterTokens.SINGLE_QUOTE.getToken();
+        addItems.propertySpecifiers.add(pos);
+        
+        MXMLDescriptorSpecifier rel = new MXMLDescriptorSpecifier();
+        rel.isProperty = true;
+        rel.name = "relativeTo";
+        rel.parent = addItems;
+        rel.value = ASEmitterTokens.SINGLE_QUOTE.getToken() + relativeToPropertyValue + ASEmitterTokens.SINGLE_QUOTE.getToken();
+        addItems.propertySpecifiers.add(rel);
+        
+        inStatesOverride = false;
+    }
+
+    private String nameToString(Name name)
+    {
+        String s = "";
+        Namespace ns = name.getSingleQualifier();
+        s = ns.getName() + ASEmitterTokens.MEMBER_ACCESS.getToken() + name.getBaseName();
+        return s;
+    }
+    /**
+     * Determines whether a node is state-dependent.
+     * TODO: we should move to IMXMLNode
+     */
+    protected boolean isStateDependent(IASNode node)
+    {
+        if (node instanceof IMXMLSpecifierNode)
+        {
+            String suffix = ((IMXMLSpecifierNode)node).getSuffix();
+            return suffix != null && suffix.length() > 0;
+        }
+        else if (isStateDependentInstance(node))
+            return true;
+        return false;
+    }
+    
+    /**
+     * Determines whether the geven node is an instance node, as is state dependent
+     */
+    protected boolean isStateDependentInstance(IASNode node)
+    {
+        if (node instanceof IMXMLInstanceNode)
+        {
+            String[] includeIn = ((IMXMLInstanceNode)node).getIncludeIn();
+            String[] excludeFrom = ((IMXMLInstanceNode)node).getExcludeFrom();
+            return includeIn != null || excludeFrom != null;
+        }
+        return false;
+    }
+    
+
     @Override
     public void emitPropertySpecifier(IMXMLPropertySpecifierNode node)
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index 47014e6..eb1adfe 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -24,8 +24,10 @@ import java.util.Set;
 
 import org.apache.flex.compiler.common.DependencyType;
 import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitterTokens;
 import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
 import org.apache.flex.compiler.internal.scopes.ASProjectScope.DefinitionPromise;
+import org.apache.flex.compiler.internal.tree.mxml.MXMLClassDefinitionNode;
 import org.apache.flex.compiler.internal.workspaces.Workspace;
 import org.apache.flex.compiler.units.ICompilationUnit;
 
@@ -44,6 +46,7 @@ public class FlexJSProject extends FlexProject
     public FlexJSProject(Workspace workspace)
     {
         super(workspace);
+        MXMLClassDefinitionNode.GENERATED_ID_BASE = MXMLFlexJSEmitterTokens.ID_PREFIX.getToken();
     }
 
     private HashMap<ICompilationUnit, HashMap<String, DependencyType>> requires = new HashMap<ICompilationUnit, HashMap<String, DependencyType>>();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler/src/org/apache/flex/compiler/internal/as/codegen/GlobalDirectiveProcessor.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/as/codegen/GlobalDirectiveProcessor.java b/compiler/src/org/apache/flex/compiler/internal/as/codegen/GlobalDirectiveProcessor.java
index 56d7cb2..0de6497 100644
--- a/compiler/src/org/apache/flex/compiler/internal/as/codegen/GlobalDirectiveProcessor.java
+++ b/compiler/src/org/apache/flex/compiler/internal/as/codegen/GlobalDirectiveProcessor.java
@@ -44,6 +44,7 @@ import org.apache.flex.compiler.internal.tree.as.InterfaceNode;
 import org.apache.flex.compiler.internal.tree.as.NamespaceIdentifierNode;
 import org.apache.flex.compiler.internal.tree.as.PackageNode;
 import org.apache.flex.compiler.internal.tree.as.VariableNode;
+import org.apache.flex.compiler.internal.tree.mxml.MXMLDocumentNode;
 import org.apache.flex.compiler.problems.DynamicNotOnClassProblem;
 import org.apache.flex.compiler.problems.EmbedOnlyOnClassesAndVarsProblem;
 import org.apache.flex.compiler.problems.FinalOutsideClassProblem;
@@ -507,6 +508,7 @@ class GlobalDirectiveProcessor extends DirectiveProcessor
     {
         verifySkinning((ClassDefinition)d.getDefinition());
         MXMLClassDirectiveProcessor dp = new MXMLClassDirectiveProcessor(d, this.currentScope, this.emitter);
+        ((MXMLDocumentNode)d).cdp = dp;
         dp.processMainClassDefinitionNode(d);
         dp.finishClassDefinition();
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java b/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
index a6869f6..88773a5 100644
--- a/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
+++ b/compiler/src/org/apache/flex/compiler/internal/as/codegen/MXMLClassDirectiveProcessor.java
@@ -1943,7 +1943,7 @@ public class MXMLClassDirectiveProcessor extends ClassDirectiveProcessor
      * Determines the Name of the event handler method for an event node.
      * This can get called to preassign the name before the method gets generated.
      */
-    protected Name getEventHandlerName(IMXMLEventSpecifierNode eventNode)
+    public Name getEventHandlerName(IMXMLEventSpecifierNode eventNode)
     {
         // Check the map to see if a handler name
         // has already been assigned to this event node.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java b/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java
index 96093b0..36033f2 100644
--- a/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java
+++ b/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLClassDefinitionNode.java
@@ -754,7 +754,7 @@ public class MXMLClassDefinitionNode extends MXMLClassReferenceNodeBase
         return applicableStates;
     }
 
-    void generateID(IMXMLInstanceNode instanceNode)
+    public void generateID(IMXMLInstanceNode instanceNode)
     {
         if (instanceNode != null && instanceNode.getID() == null)
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fac3415b/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLDocumentNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLDocumentNode.java b/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLDocumentNode.java
index ee52b1e..3ad2c08 100644
--- a/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLDocumentNode.java
+++ b/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLDocumentNode.java
@@ -22,6 +22,7 @@ package org.apache.flex.compiler.internal.tree.mxml;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.flex.compiler.internal.as.codegen.MXMLClassDirectiveProcessor;
 import org.apache.flex.compiler.internal.scopes.MXMLFileScope;
 import org.apache.flex.compiler.internal.tree.as.NodeBase;
 import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
@@ -52,6 +53,8 @@ public class MXMLDocumentNode extends MXMLClassDefinitionNode implements IMXMLDo
         super(parent);
     }
 
+    public MXMLClassDirectiveProcessor cdp;
+    
     /**
      * A map of special attribute values.
      */


[2/3] git commit: [flex-falcon] [refs/heads/develop] - beginning of states in JS

Posted by ah...@apache.org.
beginning of states in JS


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/60776898
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/60776898
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/60776898

Branch: refs/heads/develop
Commit: 60776898237af6d32b0153ba6651925cc9391c59
Parents: e3f62b1
Author: Alex Harui <ah...@apache.org>
Authored: Tue Jun 11 23:31:34 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Jun 11 23:33:33 2013 -0700

----------------------------------------------------------------------
 .../internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java        | 2 ++
 .../flex/compiler/internal/visitor/mxml/MXMLNodeSwitch.java    | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/60776898/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 a2bd7e3..45c5c90 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
@@ -658,6 +658,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
                     continue;
                 if (imp.equals("mx.events.PropertyChangeEventKind"))
                     continue;
+                if (imp.equals("mx.core.DeferredInstanceFromFunction"))
+                    continue;
     
                 if (NativeUtils.isNative(imp))
                     continue;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/60776898/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 2d26374..a69df1f 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
@@ -110,7 +110,10 @@ public class MXMLNodeSwitch implements IASNodeStrategy
         case MXMLStyleID:
             visitor.visitStyleBlock((IMXMLStyleNode)node);
             break;
-
+        case MXMLStateID:
+            visitor.visitInstance((IMXMLInstanceNode) node);
+            break;
+            
         case MXMLApplicationID:
         case MXMLBindingID:
         case MXMLBindingAttributeID:
@@ -143,7 +146,6 @@ public class MXMLNodeSwitch implements IASNodeStrategy
         case MXMLReparentID:
         //case MXMLRepeaterID:
         case MXMLResourceID:
-        case MXMLStateID:
         case MXMLVectorID:
         case MXMLWebServiceID:
         case MXMLWebServiceOperationID: