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 2015/08/25 08:07:26 UTC

[1/2] git commit: [flex-falcon] [refs/heads/develop] - for some reason the compiler started to care about whether this file existed or not

Repository: flex-falcon
Updated Branches:
  refs/heads/develop dd822abb8 -> c044d2c28


for some reason the compiler started to care about whether this file existed or not


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

Branch: refs/heads/develop
Commit: 9053aac35a83d3a749b3fa12a1ebf93df36b6425
Parents: dd822ab
Author: Alex Harui <ah...@apache.org>
Authored: Mon Aug 24 22:36:43 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Aug 24 22:36:43 2015 -0700

----------------------------------------------------------------------
 .../flexjs/files/StockDataJSONItemConverter.as  | 40 ++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9053aac3/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.as b/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.as
new file mode 100644
index 0000000..a39606b
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.as
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+    import org.apache.flex.collections.converters.JSONItemConverter;
+    
+    public class StockDataJSONItemConverter extends JSONItemConverter
+    {
+        public function StockDataJSONItemConverter()
+        {
+            super();
+        }
+        
+        override public function convertItem(data:String):Object
+        {
+            var obj:Object = super.convertItem(data);
+			if (obj["query"]["count"] == 0)
+				return "No Data";
+			
+			obj = obj["query"]["results"]["quote"];
+			return obj;
+        }
+    }
+}
\ No newline at end of file


[2/2] git commit: [flex-falcon] [refs/heads/develop] - wasn't handling static properly

Posted by ah...@apache.org.
wasn't handling static properly


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

Branch: refs/heads/develop
Commit: c044d2c28bf32e092b1674cc8c6bc9b0da183ebb
Parents: 9053aac
Author: Alex Harui <ah...@apache.org>
Authored: Mon Aug 24 23:07:14 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Aug 24 23:07:14 2015 -0700

----------------------------------------------------------------------
 .../js/flexjs/TestFlexJSFieldMembers.java       | 33 ++++++++++++++++++++
 .../internal/codegen/js/jx/ClassEmitter.java    |  2 +-
 .../internal/codegen/js/jx/FieldEmitter.java    |  2 +-
 3 files changed, 35 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c044d2c2/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
index 6b8b4fa..820cd51 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
@@ -121,6 +121,30 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
     }
 
     @Test
+    public void testStaticField()
+    {
+        IVariableNode node = getField("static var foo;");
+        asBlockWalker.visitVariable(node);
+        assertOut("/**\n * @export\n * @type {*}\n */\nFalconTest_A.foo");
+    }
+
+    @Test
+    public void testStaticField_withType()
+    {
+        IVariableNode node = getField("static var foo:int;");
+        asBlockWalker.visitVariable(node);
+        assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.foo");
+    }
+
+    @Test
+    public void testStaticField_withTypeValue()
+    {
+        IVariableNode node = getField("static var foo:int = 420;");
+        asBlockWalker.visitVariable(node);
+        assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.foo = 420");
+    }
+
+    @Test
     public void testField_withTypeValueArrayLiteral()
     {
     	IClassNode node = (IClassNode) getNode("protected var foo:Array = [ 'foo' ]",
@@ -139,6 +163,15 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
     }
     
     @Test
+    public void testStaticField_withTypeValueObjectLiteral()
+    {
+    	IClassNode node = (IClassNode) getNode("static public var foo:Object = { 'foo': 'bar' }",
+        		IClassNode.class, WRAP_LEVEL_CLASS);
+        asBlockWalker.visitClass(node);
+        assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @export\n * @type {Object}\n */\nFalconTest_A.foo = {'foo':'bar'};");
+    }
+    
+    @Test
     public void testField_withTypeValueFunctionCall()
     {
     	IClassNode node = (IClassNode) getNode("protected var foo:Number = parseFloat('1E2')",

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c044d2c2/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
index 5112cba..7ac11be 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
@@ -152,7 +152,7 @@ public class ClassEmitter extends JSSubEmitter implements
             {
             	IVariableNode varnode = ((IVariableNode)dnode);
                 IExpressionNode vnode = varnode.getAssignedValueNode();
-                if (vnode != null && (!(varnode.isConst() || EmitterUtils.isScalar(vnode))))
+                if (vnode != null && (!(varnode.isConst() || dnode.getDefinition().isStatic() || EmitterUtils.isScalar(vnode))))
                 {
                     writeNewline();
                     write(ASEmitterTokens.THIS);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c044d2c2/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
index f5aef1a..e619cfb 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -85,7 +85,7 @@ public class FieldEmitter extends JSSubEmitter implements
         	write("_");
         }
         IExpressionNode vnode = node.getAssignedValueNode();
-        if (vnode != null && (node.isConst() || EmitterUtils.isScalar(vnode)))
+        if (vnode != null && (node.isConst() || ndef.isStatic() || EmitterUtils.isScalar(vnode)))
         {
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.EQUAL);