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 2016/04/06 17:02:19 UTC

[10/50] git commit: [flex-falcon] [refs/heads/master] - add flag to control XML method resolving

add flag to control XML method resolving


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

Branch: refs/heads/master
Commit: 7d8cc6f37c3f556413332faf325b8b9b992d8fd0
Parents: 18e6c68
Author: Alex Harui <ah...@apache.org>
Authored: Fri Feb 19 08:53:10 2016 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Feb 19 08:53:10 2016 -0800

----------------------------------------------------------------------
 .../flex/compiler/config/Configuration.java     | 35 ++++++++++++++++++++
 .../compiler/internal/projects/FlexProject.java | 11 ++++++
 .../projects/FlexProjectConfigurator.java       |  3 ++
 .../internal/tree/as/IdentifierNode.java        |  5 +--
 4 files changed, 52 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7d8cc6f3/compiler/src/org/apache/flex/compiler/config/Configuration.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/config/Configuration.java b/compiler/src/org/apache/flex/compiler/config/Configuration.java
index 79c98be..e2bbd27 100644
--- a/compiler/src/org/apache/flex/compiler/config/Configuration.java
+++ b/compiler/src/org/apache/flex/compiler/config/Configuration.java
@@ -5855,4 +5855,39 @@ public class Configuration
         configurationProblems.add(problem);
     }
 
+    private boolean strictXML = false;
+
+    /**
+     *
+     * @return True if strictXML is enabled, false otherwise.
+     */
+    public boolean isStrictXML()
+    {
+        return strictXML;
+    }
+
+    /**
+     * Controls if the compiler should try to resolve XML methods.  Enabling this makes it
+     * possible to write new XML implementations but causes more warnings.  Default is false.
+     *
+     * @param enableTelemetry True to enable strict XML checking, false to disable. The default is to disable.
+     */
+    public void setStrictXML(boolean strictXML)
+    {
+        this.strictXML = strictXML;
+    }
+
+    /**
+     * Turns on the strict XML checking in the compiler.  Enabling this makes it
+     * possible to write new XML implementations but causes more warnings.
+     *
+     */
+    @Config(advanced = true)
+    @Mapping({ "compiler", "strict-xml" })
+    @FlexOnly
+    public void setStrictXML(ConfigurationValue cv, boolean strictXML) throws CannotOpen
+    {
+        this.strictXML = strictXML;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7d8cc6f3/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java
index 574285d..9180fe1 100644
--- a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java
+++ b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProject.java
@@ -481,6 +481,7 @@ public class FlexProject extends ASProject implements IFlexProject
     private String actionScriptFileEncoding = "utf-8";
     private Map<File, List<String>> extensions;
     private boolean isFlex = false;
+    private boolean strictXML = false;
 
     /**
      * QName of the class definition for {@code <s:HTTPService>} tag.
@@ -2159,4 +2160,14 @@ public class FlexProject extends ASProject implements IFlexProject
         }
         return null;
     }
+    
+    public boolean useStrictXML()
+    {
+        return this.strictXML;
+    }
+
+    public boolean setStrictXML(boolean strictXML)
+    {
+        return this.strictXML = strictXML;
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7d8cc6f3/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
index 04f385b..5992086 100644
--- a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
+++ b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
@@ -242,6 +242,9 @@ public class FlexProjectConfigurator
 
             configValue = configuration.getProxyBaseClass();
             project.setProxyBaseClass(configValue);
+
+            project.setStrictXML(configuration.isStrictXML());
+
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7d8cc6f3/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java b/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java
index 1d18923..3859b55 100644
--- a/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java
+++ b/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java
@@ -50,6 +50,7 @@ import org.apache.flex.compiler.internal.definitions.AmbiguousDefinition;
 import org.apache.flex.compiler.internal.definitions.DefinitionBase;
 import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
 import org.apache.flex.compiler.internal.definitions.NamespaceDefinition;
+import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.scopes.ASScope;
 import org.apache.flex.compiler.internal.semantics.PostProcessStep;
 import org.apache.flex.compiler.internal.semantics.SemanticUtils;
@@ -842,8 +843,8 @@ public class IdentifierNode extends ExpressionNodeBase implements IIdentifierNod
                     // and x is type XML you would get a can't-convert-Object-to-String
                     // problem, but there is lots of existing source code that expects
                     // this to compile with no cast.
-                    //if (isXMLish(baseType, project))
-                    //    return null;
+                    if (!((FlexProject)project).useStrictXML() && isXMLish(baseType, project))
+                        return null;
                     
                     if (baseExpr instanceof IdentifierNode)
                     {