flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [4/4] git commit: [flex-falcon] [refs/heads/develop] - Cleaned up special case code for toString()
Date Wed, 06 Jan 2016 15:43:31 GMT
Cleaned up special case code for toString()

Fixes missing toString() in generated Date.as and others


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

Branch: refs/heads/develop
Commit: d868ffda1a2c8a91e4752412b53bcafe868a20f1
Parents: ef2ed76
Author: Andy Dufilie <andrew.dufilie@iweave.com>
Authored: Tue Jan 5 10:06:55 2016 -0500
Committer: Andy Dufilie <andrew.dufilie@iweave.com>
Committed: Wed Jan 6 09:21:36 2016 -0500

----------------------------------------------------------------------
 .../codegen/externals/reference/ClassReference.java     | 12 ++++++++++--
 .../codegen/externals/reference/MethodReference.java    | 12 ++++--------
 2 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d868ffda/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
index 59c5859..405aaa0 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
@@ -572,9 +572,17 @@ public class ClassReference extends BaseReference
         MethodReference method = new MethodReference(getModel(), this, node, functionName,
comment, isStatic);
 
         if (isStatic)
-        	staticMethods.put(functionName, method);
+        {
+            staticMethods.put(functionName, method);
+        }
+        else if (getQualifiedName().equals("Object") && functionName.equals("toString"))
+        {
+            // skipping Object.prototype.toString() allows toString(opt_radix) for Number,
int and uint
+        }
         else
-        	instanceMethods.put(functionName, method);
+        {
+       	    instanceMethods.put(functionName, method);
+        }
         return method;
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d868ffda/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
index 58b7034..96aa9f2 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
@@ -140,11 +140,8 @@ public class MethodReference extends MemberReference
         }
 
         String qName = getQualifiedName();
-        // allow overrides of toString for Number, int and uint
-        if (!qName.equals("toString") && getClassReference().hasSuperMethod(qName))
-            return;
-        else if (qName.equals("toString") &&
-        		!(className.equals("Number") || className.equals("int") || className.equals("uint")))
+        // skip overrides since they have to have the same signature as the super method
+        if (getClassReference().hasSuperMethod(qName))
         	return;
 
         emitComment(sb);
@@ -198,10 +195,9 @@ public class MethodReference extends MemberReference
             braces = " { " + returns + " }";
         }
         
-        // allow overrides of toString for Number
-        if (qName.equals("toString") && getClassReference().hasSuperMethod(qName))
+        if (getClassReference().hasSuperMethod(qName))
         {
-        	publicModifier = "AS3 ";
+        	isOverride = "override ";
         }
 
     	if (outputJS)


Mime
View raw message