Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3EBC9F65A for ; Sat, 20 Apr 2013 00:18:13 +0000 (UTC) Received: (qmail 31257 invoked by uid 500); 20 Apr 2013 00:18:12 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 31219 invoked by uid 500); 20 Apr 2013 00:18:12 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 31188 invoked by uid 99); 20 Apr 2013 00:18:12 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Apr 2013 00:18:12 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1260181B3D4; Sat, 20 Apr 2013 00:18:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Sat, 20 Apr 2013 00:18:13 -0000 Message-Id: <79b4557f24984573942e8e74b6d547fd@git.apache.org> In-Reply-To: <282fed1607364c8693177d7b6fc848b9@git.apache.org> References: <282fed1607364c8693177d7b6fc848b9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/6] git commit: [flex-falcon] - Handle Vector.length Handle Vector.length Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/c30116a2 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/c30116a2 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/c30116a2 Branch: refs/heads/develop Commit: c30116a26fd990be8785d1f112ddc15a3ffd05a9 Parents: 2e0b423 Author: Alex Harui Authored: Fri Apr 19 09:43:50 2013 -0700 Committer: Alex Harui Committed: Fri Apr 19 09:46:05 2013 -0700 ---------------------------------------------------------------------- .../codegen/js/flexjs/TestFlexJSExpressions.java | 19 +++++++++++++++ .../apache/flex/compiler/utils/NativeUtils.java | 2 + 2 files changed, 21 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c30116a2/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 da344c0..56d0aef 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 @@ -504,6 +504,17 @@ public class TestFlexJSExpressions extends TestGoogExpressions assertOut("/**\n * @expose\n * @return {number}\n */\nfoo.bar.B.prototype.b = function() {\n\tvar /** @type {string} */ s;\n\treturn s.length;\n}"); } + @Test + public void testNativeVectorGetter() + { + IFunctionNode node = (IFunctionNode) getNode( + "public class B {public function b():int { var a:Vector.; return a.length; }}", + IFunctionNode.class, WRAP_LEVEL_PACKAGE, true); + asBlockWalker.visitFunction(node); + // String.length is a getter but is a property in JS, so don't generate set_length() call. + assertOut("/**\n * @expose\n * @return {number}\n */\nfoo.bar.B.prototype.b = function() {\n\tvar self = this;\n\tvar /** @type {Vector.} */ a;\n\treturn a.length;\n}"); + } + //---------------------------------- // Other //---------------------------------- @@ -524,6 +535,14 @@ public class TestFlexJSExpressions extends TestGoogExpressions assertOut("FalconTest_A.prototype.foo = function() {\n\tbar(b).text = '';\n}"); } + @Test + public void testComplexBooleanExpression() + { + IFunctionNode node = getMethod("function foo(b:Boolean):Boolean {var c:String; var d:String; if (!(b ? c : d)) { return b;}"); + asBlockWalker.visitFunction(node); + assertOut("/**\n * @param {boolean} b\n * @return {boolean}\n */\nFalconTest_A.prototype.foo = function(b) {\n\tvar self = this;\n\tvar /** @type {string} */ c;\n\tvar /** @type {string} */ d;\n\tif (!(b ? c : d)) {\n\t\treturn b;\n\t}\n}"); + } + @Override @Test public void testVisitAs() http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c30116a2/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java b/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java index 554a231..c56812e 100644 --- a/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java +++ b/compiler.jx/src/org/apache/flex/compiler/utils/NativeUtils.java @@ -90,6 +90,8 @@ public class NativeUtils if (test.getValue().equals(type)) return true; } + if (type.startsWith("Vector.<")) + return true; return false; } }