Repository: flex-falcon
Updated Branches:
  refs/heads/develop d041f1b8e -> 26ff39a60


Added fixes for parsing and compiling the svg.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/26ff39a6
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/26ff39a6
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/26ff39a6

Branch: refs/heads/develop
Commit: 26ff39a60d46a7e61bbdb6cedee4d9aa425a7a1b
Parents: d041f1b
Author: Michael Schmalle <mschma...@apache.org>
Authored: Thu Jun 18 07:46:53 2015 -0400
Committer: Michael Schmalle <mschma...@apache.org>
Committed: Thu Jun 18 07:46:53 2015 -0400

----------------------------------------------------------------------
 .../codegen/externals/ExternalsTestUtils.java   |  7 +++
 .../externals/reference/ClassReference.java     | 47 ++++++++++++------
 .../externals/reference/FieldReference.java     | 51 ++++++++++++--------
 .../externals/reference/MethodReference.java    | 12 -----
 4 files changed, 70 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/26ff39a6/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
index 4f3092f..2cb8795 100644
--- 
a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
+++ 
b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestUtils.java
@@ -74,6 +74,11 @@ public class ExternalsTestUtils
         config.addExclude("Generator", "next");
         config.addExclude("LinkStyle", "sheet");
 
+        // SVG
+        config.addExclude("SVGStylable", "className");
+        config.addExclude("SVGStylable", "style");
+        config.addExclude("SVGLocatable", "farthestViewportElement");
+        config.addExclude("SVGLocatable", "nearestViewportElement");
     }
 
     public static void addTestExternalsFull(ExternCConfiguration config)
@@ -131,5 +136,7 @@ public class ExternalsTestUtils
 
         config.addExternal(coreRoot + "/webgl.js");
         config.addExternal(coreRoot + "/webstorage.js");
+
+        //config.addExternal(coreRoot + "/svg.js");
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/26ff39a6/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 d99c0de..7cc595d 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
@@ -395,15 +395,31 @@ public class ClassReference extends BaseReference
         return result;
     }
 
+    public List<ClassReference> getInterfaces()
+    {
+        ArrayList<ClassReference> result = new ArrayList<ClassReference>();
+        List<JSTypeExpression> implementedInterfaces = 
getComment().getImplementedInterfaces();
+        for (JSTypeExpression jsTypeExpression : implementedInterfaces)
+        {
+            JSType jsType = getModel().evaluate(jsTypeExpression);
+            String interfaceName = jsType.toAnnotationString();
+            result.add(getModel().getClassReference(interfaceName));
+        }
+        return result;
+    }
+
     public List<ClassReference> getSuperInterfaces()
     {
         ArrayList<ClassReference> result = new ArrayList<ClassReference>();
+        result.addAll(getInterfaces());
+
         ClassReference superClass = getSuperClass();
         while (superClass != null)
         {
-            result.add(superClass);
+            result.addAll(superClass.getInterfaces());
             superClass = superClass.getSuperClass();
         }
+
         return result;
     }
 
@@ -570,19 +586,19 @@ public class ClassReference extends BaseReference
         return false;
     }
 
-    public boolean isPropertyInterfaceImplementation(FieldReference reference)
+    public boolean isPropertyInterfaceImplementation(String fieldName)
     {
-        //        List<ClassReference2> superInterfaces = getSuperInterfaces();
-        //        for (ClassReference2 interfaceRef : superInterfaces)
-        //        {
-        //            if (interfaceRef == null)
-        //            {
-        //                
System.err.println("isPropertyInterfaceImplementation() null");
-        //                continue;
-        //            }
-        //            if (interfaceRef.hasFieldConflict(reference))
-        //                return true;
-        //        }
+        List<ClassReference> superInterfaces = getSuperInterfaces();
+        for (ClassReference interfaceRef : superInterfaces)
+        {
+            if (interfaceRef == null)
+            {
+                System.err.println("isPropertyInterfaceImplementation() null");
+                continue;
+            }
+            if (interfaceRef.hasFieldConflict(fieldName))
+                return true;
+        }
         return false;
     }
 
@@ -591,9 +607,9 @@ public class ClassReference extends BaseReference
         return methods.containsKey(functionName);
     }
 
-    public boolean hasFieldConflict(FieldReference reference)
+    public boolean hasFieldConflict(String fieldName)
     {
-        return getFields().containsKey(reference.getQualifiedName());
+        return fields.containsKey(fieldName);
     }
 
     public void addImport(String qualifiedName)
@@ -719,7 +735,6 @@ public class ClassReference extends BaseReference
             sb.append("\n");
             nextEnumConstant();
         }
-
     }
 
     private void emitMethods(StringBuilder sb)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/26ff39a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
 
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
index 618a13a..060421e 100644
--- 
a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
+++ 
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
@@ -20,7 +20,6 @@
 package org.apache.flex.compiler.internal.codegen.externals.reference;
 
 import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMemeber;
-import org.apache.flex.compiler.internal.codegen.externals.utils.FunctionUtils;
 import org.apache.flex.compiler.internal.codegen.externals.utils.JSTypeUtils;
 
 import com.google.javascript.rhino.JSDocInfo;
@@ -98,8 +97,10 @@ public class FieldReference extends MemberReference
             return; // XXX (mschmalle) accessors are not treated right, need 
to exclude get/set
         }
 
-        if (!getClassReference().isInterface() && !getComment().isOverride())
-        //&& !getClassReference().isPropertyInterfaceImplementation(this))
+        if (!getClassReference().isInterface()
+                && !getComment().isOverride()
+                && !getClassReference().isPropertyInterfaceImplementation(
+                        getBaseName()))
         {
             emitVar(sb);
         }
@@ -111,16 +112,39 @@ public class FieldReference extends MemberReference
 
     private void emitAccessor(StringBuilder sb)
     {
+        boolean isInterface = getClassReference().isInterface();
+
         String staticValue = "";//(isStatic) ? "static " : "";
+        String isPublic = isInterface ? "" : "public ";
+        String getBody = isInterface ? "" : "{ return null; }";
+        String setBody = isInterface ? "" : "{}";
 
-        String isPublic = getClassReference().isInterface() ? "" : "public ";
+        String type = toTypeString();
+        if (type.indexOf("|") != -1 || type.indexOf("?") != -1)
+            type = "*";
 
+        // getter
         sb.append(indent);
-        sb.append(isPublic + staticValue + "function get " + getQualifiedName()
-                + "():" + toReturnString() + ";\n");
+        sb.append(isPublic);
+        sb.append(staticValue);
+        sb.append("function get ");
+        sb.append(getBaseName());
+        sb.append("():");
+        sb.append(type);
+        sb.append(getBody);
+        sb.append(";\n");
+
+        // setter
         sb.append(indent);
-        sb.append(isPublic + staticValue + "function set " + getQualifiedName()
-                + "(" + toPrameterString() + "):void" + ";\n");
+        sb.append(isPublic);
+        sb.append(staticValue);
+        sb.append("function set ");
+        sb.append(getBaseName());
+        sb.append("(value:");
+        sb.append(type);
+        sb.append("):void");
+        sb.append(setBody);
+        sb.append(";\n");
     }
 
     private void emitVar(StringBuilder sb)
@@ -168,17 +192,6 @@ public class FieldReference extends MemberReference
         return JSTypeUtils.toFieldString(this);
     }
 
-    private String toReturnString()
-    {
-        return toPrameterString().replace("value:", "");
-    }
-
-    private String toPrameterString()
-    {
-        return FunctionUtils.toParameter(this, getComment(), "value",
-                getComment().getType());
-    }
-
     @Override
     protected void emitCommentBody(StringBuilder sb)
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/26ff39a6/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 3508b03..fac8260 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
@@ -113,18 +113,6 @@ public class MethodReference extends MemberReference
             }
         }
 
-        //        if (isOverride())
-        //        {
-        //            //isOverride = "override ";
-        //            if 
(getClassReference().isMethodOverrideFromInterface(this))
-        //            {
-        //                override = 
getClassReference().getMethodOverrideFromInterface(
-        //                        this);
-        //
-        //                isOverride = "";
-        //            }
-        //        }
-
         String publicModifier = "";
         String braces = "";
         String returns = "";

Reply via email to