flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [18/24] git commit: [flex-falcon] [refs/heads/JsToAs] - handle collisions between global classes and classes in a package. Folks can use 'window' to qualify references to classes in the global package and we will ignore global classes unless explicitly
Date Tue, 22 Sep 2015 17:34:56 GMT
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx.tests/test-files/flexjs/projects/package_conflicts_use_window/otherpackage/Event_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/package_conflicts_use_window/otherpackage/Event_result.js b/compiler.jx.tests/test-files/flexjs/projects/package_conflicts_use_window/otherpackage/Event_result.js
new file mode 100644
index 0000000..64b5249
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/projects/package_conflicts_use_window/otherpackage/Event_result.js
@@ -0,0 +1,39 @@
+/**
+ * Licensed 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.
+ */
+/**
+ * Generated by Apache Flex Cross-Compiler from otherpackage/Event.as
+ * otherpackage.Event
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes}
+ */
+
+goog.provide('otherpackage.Event');
+
+
+
+/**
+ * @constructor
+ */
+otherpackage.Event = function() {
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+otherpackage.Event.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Event', qName: 'otherpackage.Event'}] };

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
index c159428..7b433cd 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
@@ -54,11 +54,11 @@ public interface IJSGoogDocEmitter extends IJSDocEmitter
 
     void emitInterfaceMemberDoc(IDefinitionNode node, ICompilerProject project);
     
-    void emitFieldDoc(IVariableNode node, IDefinition def);
+    void emitFieldDoc(IVariableNode node, IDefinition def, ICompilerProject project);
 
     void emitMethodDoc(IFunctionNode node, ICompilerProject project);
 
-    void emitVarDoc(IVariableNode node, IDefinition def);
+    void emitVarDoc(IVariableNode node, IDefinition def, ICompilerProject project);
 
     /*
      * https://developers.google.com/closure/compiler/docs/js-for-compiler#types

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBeforeNodeStrategy.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBeforeNodeStrategy.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBeforeNodeStrategy.java
index f232bf3..d481573 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBeforeNodeStrategy.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBeforeNodeStrategy.java
@@ -21,11 +21,8 @@ package org.apache.flex.compiler.internal.codegen.as;
 
 import org.apache.flex.compiler.codegen.IEmitter;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
-import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
-import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
-import org.apache.flex.compiler.tree.as.IClassNode;
 import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IContainerNode.ContainerType;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
index e671aca..9296a78 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitterTokens.java
@@ -133,8 +133,8 @@ public enum ASEmitterTokens implements IEmitterTokens
     LESS_THAN("<"),
     //    int TOKEN_OPERATOR_LESS_THAN_EQUALS = 99;
     INSTANCEOF("instanceof"),
-    IS("_is"),
-    AS("_as"),
+    IS("is"),
+    AS("as"),
     //    int TOKEN_OPERATOR_BITWISE_LEFT_SHIFT = 103;
     //    int TOKEN_OPERATOR_BITWISE_RIGHT_SHIFT = 104;
     //    int TOKEN_OPERATOR_BITWISE_UNSIGNED_RIGHT_SHIFT = 105;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
index 5d671b5..2cf1667 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
@@ -90,6 +90,8 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
             return name;
         name = name.replaceAll("\\.", "_");
         */
+    	if (name.startsWith("window."))
+    		name = name.substring(7);
         return name;
     }
 
@@ -119,7 +121,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
                 IClassDefinition parent = (IClassDefinition) node
                         .getDefinition().getParent();
                 IClassDefinition superClass = parent.resolveBaseClass(project);
-                String qname = (superClass != null) ? superClass.getQualifiedName() : null;
+                String qname = (superClass != null) ? project.getActualPackageName(superClass.getQualifiedName()) : null;
 
                 if (superClass != null
                         && !qname.equals(IASLanguageConstants.Object))
@@ -137,7 +139,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
                         System.out.println(iReference.getDisplayString()
                                 + " not resolved in "
                                 + classDefinition.getQualifiedName());
-                    emitImplements(type, type.getPackageName());
+                    emitImplements(type, project.getActualPackageName(type.getPackageName()));
                 }
             }
             else
@@ -182,7 +184,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
                 if (tdef == null)
                     continue;
 
-                emitParam(pnode, tdef.getPackageName());
+                emitParam(pnode, project.getActualPackageName(tdef.getPackageName()));
             }
 
             if (!node.isConstructor())
@@ -208,7 +210,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
                     String packageName = "";
                     packageName = tdef != null ? tdef.getPackageName() : "";
 
-                    emitReturn(node, packageName);
+                    emitReturn(node, project.getActualPackageName(packageName));
                 }
 
                 // @override
@@ -323,7 +325,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
     }
 
     @Override
-    public void emitFieldDoc(IVariableNode node, IDefinition def)
+    public void emitFieldDoc(IVariableNode node, IDefinition def, ICompilerProject project)
     {
         begin();
 
@@ -348,7 +350,7 @@ public class JSFlexJSDocEmitter extends JSGoogDocEmitter
         if (def != null)
             packageName = def.getPackageName();
 
-        emitType(node, packageName);
+        emitType(node, project.getActualPackageName(packageName));
 
         end();
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 2dcb1ef..24d35d5 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -224,6 +224,8 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
             return name;
         name = name.replaceAll("\\.", "_");
         */
+    	if (name.startsWith("window."))
+    		name = name.substring(7);
         return name;
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
index 16b9aeb..3da58b0 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
@@ -104,7 +104,7 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
     }
 
     @Override
-    public void emitFieldDoc(IVariableNode node, IDefinition def)
+    public void emitFieldDoc(IVariableNode node, IDefinition def, ICompilerProject project)
     {
         begin();
 
@@ -237,7 +237,7 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
     }
 
     @Override
-    public void emitVarDoc(IVariableNode node, IDefinition def)
+    public void emitVarDoc(IVariableNode node, IDefinition def, ICompilerProject project)
     {
         String packageName = "";
         if (def != null)
@@ -248,8 +248,6 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
             IDefinition ndef = node.getDefinition();
             if (emitter != null && emitter instanceof JSFlexJSEmitter)
             {
-                ICompilerProject project = ((JSFlexJSEmitter) emitter)
-                        .getWalker().getProject();
                 ITypeDefinition type = ndef.resolveType(project);
                 if (type != null)
                 {
@@ -257,14 +255,14 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
                 }
             }
 
-            emitTypeShort(node, packageName);
+            emitTypeShort(node, project.getActualPackageName(packageName));
         }
         else
         {
             writeNewline();
             begin();
             emitConst(node);
-            emitType(node, packageName);
+            emitType(node, project.getActualPackageName(packageName));
             end();
         }
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index b3b0f04..2250e40 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -39,7 +39,6 @@ import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSessionModel;
-import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
 import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
 import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
@@ -336,7 +335,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         if (enode != null)
             def = enode.resolveType(getWalker().getProject());
 
-        getDocEmitter().emitFieldDoc(node, def);
+        getDocEmitter().emitFieldDoc(node, def, getWalker().getProject());
 
         /* x.prototype.y = z */
 
@@ -391,11 +390,11 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
 
             String opcode = avnode.getNodeID().getParaphrase();
             if (opcode != "AnonymousFunction")
-                getDocEmitter().emitVarDoc(node, def);
+                getDocEmitter().emitVarDoc(node, def, getWalker().getProject());
         }
         else
         {
-            getDocEmitter().emitVarDoc(node, null);
+            getDocEmitter().emitVarDoc(node, null, getWalker().getProject());
         }
 
         emitDeclarationName(node);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
index 35aabeb..e958fe1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
@@ -43,12 +43,10 @@ import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.semantics.SemanticUtils;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
-import org.apache.flex.compiler.internal.tree.as.GetterNode;
 import org.apache.flex.compiler.internal.tree.as.SetterNode;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IAccessorNode;
-import org.apache.flex.compiler.tree.as.IClassNode;
 import org.apache.flex.compiler.tree.as.IGetterNode;
 import org.apache.flex.compiler.tree.as.ISetterNode;
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index a12ac6d..4a7d1e7 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -27,7 +27,6 @@ import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens;
 import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
-import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.ASTNodeID;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/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 7ac11be..15fdf2e 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
@@ -24,7 +24,6 @@ import org.apache.flex.compiler.clients.MXMLJSC;
 import org.apache.flex.compiler.codegen.ISubEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.definitions.IClassDefinition;
-import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.definitions.IFunctionDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/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 e619cfb..ea64639 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
@@ -58,7 +58,7 @@ public class FieldEmitter extends JSSubEmitter implements
         // TODO (mschmalle)
         if (getEmitter().getDocEmitter() instanceof IJSGoogDocEmitter)
         {
-            ((IJSGoogDocEmitter) getEmitter().getDocEmitter()).emitFieldDoc(node, def);
+            ((IJSGoogDocEmitter) getEmitter().getDocEmitter()).emitFieldDoc(node, def, getProject());
         }
 
         IDefinition ndef = node.getDefinition();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
index 9266e7c..c2c2963 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
@@ -25,12 +25,10 @@ import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.definitions.IFunctionDefinition.FunctionClassification;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
-import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
 import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
 import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
-import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
index 834e612..52945de 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
@@ -86,6 +86,7 @@ public class InterfaceEmitter extends JSSubEmitter implements
                 	String propType = accessor.getVariableType();
                 	IExpressionNode typeNode = accessor.getVariableTypeNode();
                 	String packageName = typeNode.getPackageName();
+                	packageName = project.getActualPackageName(packageName);
                     write(JSDocEmitterTokens.JSDOC_OPEN);
                     write(ASEmitterTokens.SPACE);
                     fjs.getDocEmitter().emitType(propType, packageName);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index ef5be6b..bda108d 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@ -58,11 +58,11 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
 
             String opcode = avnode.getNodeID().getParaphrase();
             if (opcode != "AnonymousFunction")
-                fjs.getDocEmitter().emitVarDoc(node, def);
+                fjs.getDocEmitter().emitVarDoc(node, def, getWalker().getProject());
         }
         else
         {
-            fjs.getDocEmitter().emitVarDoc(node, null);
+            fjs.getDocEmitter().emitVarDoc(node, null, getWalker().getProject());
         }
 
         if (!(node instanceof ChainedVariableNode) && node.isConst())

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java
index 3bea2e9..3147c20 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSDocEmitter.java
@@ -185,7 +185,7 @@ public class JSVF2JSDocEmitter extends JSGoogDocEmitter
     }
     
     @Override
-    public void emitVarDoc(IVariableNode node, IDefinition def)
+    public void emitVarDoc(IVariableNode node, IDefinition def, ICompilerProject project)
     {
         String packageName = "";
         if (def != null)
@@ -196,7 +196,6 @@ public class JSVF2JSDocEmitter extends JSGoogDocEmitter
             IDefinition ndef = node.getDefinition();
             if (emitter != null && emitter instanceof JSVF2JSEmitter)
             {
-            	ICompilerProject project = ((JSVF2JSEmitter)emitter).project;
                 if (project != null)
                 {
                     packageName = ((ITypeDefinition)ndef.resolveType(project))

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
index f6133dc..55c5f9e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
@@ -341,11 +341,11 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
 
             String opcode = avnode.getNodeID().getParaphrase();
             if (opcode != "AnonymousFunction")
-                getDocEmitter().emitVarDoc(node, def);
+                getDocEmitter().emitVarDoc(node, def, getWalker().getProject());
         }
         else
         {
-            getDocEmitter().emitVarDoc(node, null);
+            getDocEmitter().emitVarDoc(node, null, getWalker().getProject());
         }
 
         emitDeclarationName(node);
@@ -396,7 +396,7 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
             def = enode.resolveType(project);
         }
 
-        getDocEmitter().emitFieldDoc(node, def);
+        getDocEmitter().emitFieldDoc(node, def, project);
 
         IDefinition ndef = node.getDefinition();
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 6a7b634..12aafab 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -59,7 +59,6 @@ import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
-import org.apache.flex.compiler.tree.as.IClassNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IImportNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index e9b89af..15c491f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -19,19 +19,24 @@
 package org.apache.flex.compiler.internal.projects;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Set;
 
 import org.apache.flex.compiler.common.DependencyType;
 import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.definitions.IScopedDefinition;
 import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitterTokens;
 import org.apache.flex.compiler.internal.css.codegen.CSSCompilationSession;
 import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
 import org.apache.flex.compiler.internal.driver.js.flexjs.JSCSSCompilationSession;
 import org.apache.flex.compiler.internal.scopes.ASProjectScope.DefinitionPromise;
+import org.apache.flex.compiler.internal.scopes.ASScope;
+import org.apache.flex.compiler.internal.scopes.PackageScope;
 import org.apache.flex.compiler.internal.targets.LinkageChecker;
 import org.apache.flex.compiler.internal.tree.mxml.MXMLClassDefinitionNode;
+import org.apache.flex.compiler.internal.units.SWCCompilationUnit;
 import org.apache.flex.compiler.internal.workspaces.Workspace;
 import org.apache.flex.compiler.targets.ITargetSettings;
 import org.apache.flex.compiler.tree.as.IASNode;
@@ -132,6 +137,9 @@ public class FlexJSProject extends FlexProject
     
     private LinkageChecker linkageChecker;
     private ITargetSettings ts;
+    
+    // definitions that should be considered external linkage
+    public Collection<String> unitTestExterns;
 
     private boolean isExternalLinkage(ICompilationUnit cu)
     {
@@ -142,7 +150,20 @@ public class FlexJSProject extends FlexProject
         }
         // in unit tests, ts may be null and LinkageChecker NPEs
         if (ts == null)
+        {
+        	if (unitTestExterns != null)
+        	{
+        		try {
+        			if (!(cu instanceof SWCCompilationUnit))
+        				if (unitTestExterns.contains(cu.getQualifiedNames().get(0)))
+        					return true;
+				} catch (InterruptedException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+        	}
             return false;
+        }
 
         try
         {
@@ -214,4 +235,56 @@ public class FlexJSProject extends FlexProject
     {
         astCache.put(ast, "");
     }
+    
+    @Override
+    public String getActualPackageName(String packageName)
+    {
+    	if (packageName.startsWith("window."))
+    		return packageName.substring(7);
+    	if (packageName.equals("window"))
+    		return "";
+        return packageName;
+    }
+
+    @Override
+    public IDefinition doubleCheckAmbiguousDefinition(ASScope scope, String name, IDefinition def1, IDefinition def2)
+    {
+        IScopedDefinition scopeDef = scope.getContainingDefinition();
+        String thisPackage = scopeDef.getPackageName();
+        String package1 = def1.getPackageName();
+        String package2 = def2.getPackageName();
+        // if the conflicts is against a class in the global/window package
+        // then return the other one.
+        if (package1.equals(thisPackage) && package2.length() == 0)
+            return def1;
+        if (package2.equals(thisPackage) && package1.length() == 0)
+            return def2;
+        if (package1.length() == 0 || package2.length() == 0)
+        {
+            // now check to see if the class was imported in the window package.
+            ASScope pkgScope = scope;
+            while (!(pkgScope instanceof PackageScope))
+                pkgScope = pkgScope.getContainingScope();
+            String[] imports = pkgScope.getImports();
+            String windowName = "window." + name;
+            boolean usingWindow = false;
+            for (String imp : imports)
+            {
+                if (imp.equals(windowName))
+                {
+                    usingWindow = true;
+                    break;
+                }
+            }
+            // if they did not import via the window package, then assume
+            // that they meant the one they did import
+            if (!usingWindow)
+            {
+                return package1.length() == 0 ? def2 : def1;
+            }
+            // otherwise fall through to ambiguous because they need to qualify
+            // with the package name, even if it is 'window'
+        }
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.tests/feature-tests/as/ASFeatureTestsBase.java
----------------------------------------------------------------------
diff --git a/compiler.tests/feature-tests/as/ASFeatureTestsBase.java b/compiler.tests/feature-tests/as/ASFeatureTestsBase.java
new file mode 100644
index 0000000..cb1d7eb
--- /dev/null
+++ b/compiler.tests/feature-tests/as/ASFeatureTestsBase.java
@@ -0,0 +1,247 @@
+/*
+ *
+ *  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 as;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.*;
+
+import org.apache.flex.compiler.clients.MXMLC;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.utils.EnvProperties;
+import org.apache.flex.utils.FilenameNormalization;
+import org.apache.flex.utils.StringUtils;
+
+
+/**
+ * Base class for AS feature tests which compile AS code with MXMLC and run it in the standalone Flash Player.
+ * Copied and modified from MXMLFeatureTestsBase.java
+ */
+public class ASFeatureTestsBase
+{
+	private static EnvProperties env = EnvProperties.initiate();
+	
+	private static final String PLAYERGLOBAL_SWC = FilenameNormalization.normalize(env.FPSDK + "\\" + env.FPVER + "\\playerglobal.swc");
+	
+	private static final String FRAMEWORK_SWC = FilenameNormalization.normalize(env.SDK + "\\frameworks\\libs\\framework.swc");
+	private static final String FRAMEWORK_RB_SWC = FilenameNormalization.normalize(env.SDK + "\\frameworks\\locale\\en_US\\framework_rb.swc");
+	
+	private static final String RPC_SWC = FilenameNormalization.normalize(env.SDK + "\\frameworks\\libs\\rpc.swc");
+	private static final String RPC_RB_SWC = FilenameNormalization.normalize(env.SDK + "\\frameworks\\locale\\en_US\\rpc_rb.swc");
+
+	private static final String SPARK_SWC = FilenameNormalization.normalize(env.SDK + "\\frameworks\\libs\\spark.swc");
+	private static final String SPARK_RB_SWC = FilenameNormalization.normalize(env.SDK + "\\frameworks\\locale\\en_US\\spark_rb.swc");
+	
+	private static final String NAMESPACE_2009 = "http://ns.adobe.com/mxml/2009";
+    
+	private static final String MANIFEST_2009 = FilenameNormalization.normalize(env.SDK + "\\frameworks\\mxml-2009-manifest.xml");
+    
+    // The Ant script for compiler.tests copies a standalone player to the temp directory.
+    private static final String FLASHPLAYER = FilenameNormalization.normalize(env.FDBG);
+
+	protected void compileAndRun(String source, boolean withFramework, boolean withRPC, boolean withSpark, String[] otherOptions)
+	{
+		System.out.println("Generating test:");
+
+		// Write the MXML into a temp file.
+		String tempDir = FilenameNormalization.normalize("temp");
+		File tempASFile = null;
+		try
+		{
+			tempASFile = File.createTempFile(getClass().getSimpleName(), ".as", new File(tempDir));
+			tempASFile.deleteOnExit();
+
+			BufferedWriter out = new BufferedWriter(new FileWriter(tempASFile));
+			String className = tempASFile.getName();
+			// chop off .as
+			className = className.substring(0, className.length() - 3);
+			
+			source = source.replaceAll("%0", className);
+		    out.write(source);
+		    out.close();
+		}
+		catch (IOException e1) 
+		{
+			e1.printStackTrace();
+			fail("Error generating test code");
+		}
+
+		// Build the list of SWCs to compile against on the library path.
+		List<String> swcs = new ArrayList<String>();
+		if (withFramework)
+		{
+			swcs.add(FRAMEWORK_SWC);
+			swcs.add(FRAMEWORK_RB_SWC);
+		}
+		if (withRPC)
+		{
+			swcs.add(RPC_SWC);
+			swcs.add(RPC_RB_SWC);
+		}
+		if (withSpark)
+		{
+			swcs.add(SPARK_SWC);
+			swcs.add(SPARK_RB_SWC);
+		}
+		String libraryPath = "-library-path=" + StringUtils.join(swcs.toArray(new String[swcs.size()]), ",");
+		
+		List<String> args = new ArrayList<String>();
+		args.add("-external-library-path=" + PLAYERGLOBAL_SWC);
+		args.add(libraryPath);
+		args.add("-namespace=" + NAMESPACE_2009 + "," + MANIFEST_2009);
+		if (otherOptions != null)
+		{
+			Collections.addAll(args, otherOptions);
+		}
+		args.add(tempASFile.getAbsolutePath());
+
+		// Use MXMLC to compile the MXML file against playerglobal.swc and possibly other SWCs.
+		MXMLC mxmlc = new MXMLC();
+		StringBuffer cmdLine = new StringBuffer();
+		for(String arg : args) {
+			cmdLine.append(arg).append(" ");
+		}
+		System.out.println("Compiling test:\n" + cmdLine.toString());
+		int exitCode = mxmlc.mainNoExit(args.toArray(new String[args.size()]));
+
+		// Check that there were no compilation problems.
+		List<ICompilerProblem> problems = mxmlc.getProblems().getProblems();
+		StringBuilder sb = new StringBuilder("Unxpected compilation problems:\n");
+		for (ICompilerProblem problem : problems)
+		{
+			sb.append(problem.toString());
+			sb.append('\n');
+		}
+		assertThat(sb.toString(), exitCode, is(0));
+
+		// Check the existence of the flashplayer executable
+		File playerExecutable = new File(FLASHPLAYER);
+		if(!playerExecutable.isFile() || !playerExecutable.exists()) {
+			fail("The flashplayer executable " + FLASHPLAYER + " doesn't exist.");
+		}
+
+		// Run the SWF in the standalone player amd wait until the SWF calls System.exit().
+		String swf = FilenameNormalization.normalize(tempASFile.getAbsolutePath());
+		swf = swf.replace(".as", ".swf");
+		String[] runArgs = new String[] { FLASHPLAYER, swf };
+		try
+		{
+			System.out.println("Executing test:\n" + Arrays.toString(runArgs));
+			exitCode = executeCommandWithTimeout(runArgs, 20);
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+		
+	    // Check that the runtime exit code was 0, meaning that no asserts failed.
+		assertThat(exitCode, is(0));
+	}
+	
+	protected void compileAndRun(String source)
+	{
+		compileAndRun(source, false, false, false, null);
+	}
+
+	public static int executeCommandWithTimeout(String[] args, long timeoutInSeconds) throws Exception {
+		ExecutorService service = Executors.newSingleThreadExecutor();
+		Process process = Runtime.getRuntime().exec(args);
+		try {
+			Callable<Integer> call = new CallableProcess(process);
+			Future<Integer> future = service.submit(call);
+			return future.get(timeoutInSeconds, TimeUnit.SECONDS);
+		} catch (ExecutionException e) {
+			throw new Exception("Process failed to execute", e);
+		} catch (TimeoutException e) {
+			process.destroy();
+			throw new Exception("Process timed out", e);
+		} finally {
+			service.shutdown();
+		}
+	}
+
+	private static class CallableProcess implements Callable<Integer> {
+		private Process p;
+
+		public CallableProcess(Process process) {
+			p = process;
+		}
+
+		public Integer call() throws Exception {
+			return p.waitFor();
+		}
+	}
+
+	/**
+	 * Combines various code snippets to make a complete one-file MXML Sprite-based application.
+	 */
+    protected String getAS(String[] imports, String[] declarations, String[] testCode, String[] extraCode)
+    {
+        String[] template = new String[]
+        {
+            "package {",
+            "import flash.display.Sprite;",
+            "import flash.events.Event;",
+            "import flash.system.System;",
+            "%1",
+            "public class %0 extends flash.display.Sprite",
+            "{",
+            "    public function %0()",
+            "    {",
+            "        loaderInfo.addEventListener(flash.events.Event.INIT, initHandler);",
+            "    }",
+            "    %2",
+            "    private function initHandler(e:flash.events.Event):void",
+            "    {",
+            "        %3",
+            "        System.exit(0);",            
+            "    }",
+            "    private function assertEqual(message:String, actualValue:*, expectedValue:*):void",
+            "    {",
+            "        if (actualValue !== expectedValue)",
+            "        {",
+            "            trace(message, actualValue, expectedValue);",
+            "            System.exit(1);",
+            "        }",
+            "    }",
+            "}",
+            "}",
+            "%4"
+        };
+        String source = StringUtils.join(template, "\n");
+        source = source.replace("%1", StringUtils.join(imports, "\n"));
+        source = source.replace("%2", StringUtils.join(declarations, "\n        "));
+        source = source.replace("%3", StringUtils.join(testCode, "\n"));
+        source = source.replace("%4", StringUtils.join(extraCode, "\n"));
+        return source;
+    }
+    
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler.tests/feature-tests/as/ASNamespaceTests.java
----------------------------------------------------------------------
diff --git a/compiler.tests/feature-tests/as/ASNamespaceTests.java b/compiler.tests/feature-tests/as/ASNamespaceTests.java
new file mode 100644
index 0000000..3c488bb
--- /dev/null
+++ b/compiler.tests/feature-tests/as/ASNamespaceTests.java
@@ -0,0 +1,106 @@
+/*
+ *
+ *  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 as;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for AS Namespaces.
+ */
+public class ASNamespaceTests extends ASFeatureTestsBase
+{
+    @Test
+    public void ASNamespace_package()
+    {
+    	// all tests can assume that flash.display.Sprite
+    	// flash.system.System and flash.events.Event have been imported
+        String[] imports = new String[]
+        {
+            "import flash.utils.getQualifiedClassName;",
+        };
+        String[] testCode = new String[]
+        {
+        	"var foo:Event = new Event('foo');",
+        	"var bar:flash.events.Event = new flash.events.Event('bar');",
+            "assertEqual('qualified names', getQualifiedClassName(foo), getQualifiedClassName(bar));",
+        };
+        String source = getAS(imports, new String[0], testCode, new String[0]);
+        compileAndRun(source);
+    }
+
+    @Test
+    public void ASNamespace_custom()
+    {
+    	// all tests can assume that flash.display.Sprite
+    	// flash.system.System and flash.events.Event have been imported
+        String[] imports = new String[]
+        {
+            "import flash.utils.getQualifiedClassName;",
+            "import mx.core.mx_internal;",
+        };
+        String[] declarations = new String[]
+        {
+	       	"mx_internal var foo:Event = new Event('foo');",
+        };
+        String[] testCode = new String[]
+        {
+        	"var qname:QName = new QName(mx_internal, 'foo');",
+            "assertEqual('qualified names', getQualifiedClassName(mx_internal::foo), getQualifiedClassName(this[qname]));",
+        };
+        String source = getAS(imports, declarations, testCode, new String[0]);
+        compileAndRun(source, true, false, false, null);
+    }
+
+    /*
+     * The PackageConflict tests 
+     */
+    @Test
+    public void ASNamespace_packageConflict()
+    {
+    	// all tests can assume that flash.display.Sprite
+    	// flash.system.System and flash.events.Event have been imported
+        String[] imports = new String[]
+        {
+            "import flash.utils.getQualifiedClassName;",
+        };
+        String[] declarations = new String[]
+        {
+	       	"private var foo:Event = new Event('foo');",
+	       	"private var bar:flash.events.Event = new flash.events.Event('foo');",
+        };
+        String[] testCode = new String[]
+        {
+            "assertEqual('qualified names', getQualifiedClassName(foo), 'Event');",
+            "assertEqual('qualified names', getQualifiedClassName(bar), 'flash.events:Event');",
+        };
+        String[] extraCode = new String[]
+        {
+        	"class Event",
+            "{",
+            "    public function Event()",
+            "    {",
+            "    }",
+            "}",
+        };
+        String source = getAS(imports, declarations, testCode, extraCode);
+        compileAndRun(source, false, false, false, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java b/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java
index c378d8e..fdc2f63 100644
--- a/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java
+++ b/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java
@@ -956,4 +956,28 @@ public abstract class CompilerProject implements ICompilerProject
     {
     }
 
+    /**
+     * Override this to permit package aliasing on imports and elsewhere
+     * 
+     * @param packageName The package name
+     */
+    public String getActualPackageName(String packageName)
+    {
+        return packageName;
+    }
+    
+    /**
+     * Override this to disambiguate between two ambiguous definitinos
+     * 
+     * @param scope The current scope.
+     * @param name Definition name.
+     * @param def1 One possibility.
+     * @param def2 The other possibility.
+     * @return null if still ambiguous or else def1 or def2.
+     */
+    public IDefinition doubleCheckAmbiguousDefinition(ASScope scope, String name, IDefinition def1, IDefinition def2)
+    {
+        return null;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler/src/org/apache/flex/compiler/internal/scopes/ASScopeCache.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/scopes/ASScopeCache.java b/compiler/src/org/apache/flex/compiler/internal/scopes/ASScopeCache.java
index 9981f2a..4ae24b2 100644
--- a/compiler/src/org/apache/flex/compiler/internal/scopes/ASScopeCache.java
+++ b/compiler/src/org/apache/flex/compiler/internal/scopes/ASScopeCache.java
@@ -167,8 +167,15 @@ public class ASScopeCache
                 IDefinition d = AmbiguousDefinition.resolveAmbiguities(project, defs);
                 if (d != null)
                     def = d;
-                else
+                else {
+                    if (defs.size() == 2) 
+                    {
+                        def = project.doubleCheckAmbiguousDefinition(scope, name, defs.get(0), defs.get(1));
+                        if (def != null)
+                            return def;
+                    }
                     def = AmbiguousDefinition.get();
+                }
         }
         if (def != null)
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler/src/org/apache/flex/compiler/internal/semantics/SemanticUtils.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/semantics/SemanticUtils.java b/compiler/src/org/apache/flex/compiler/internal/semantics/SemanticUtils.java
index 97f0f04..e47ffb5 100644
--- a/compiler/src/org/apache/flex/compiler/internal/semantics/SemanticUtils.java
+++ b/compiler/src/org/apache/flex/compiler/internal/semantics/SemanticUtils.java
@@ -2655,7 +2655,8 @@ public class SemanticUtils
                                         boolean inInvisibleCompilationUnit)
     {
         String importName = importNode.getImportName();
-
+        importName = project.getActualPackageName(importName);
+        
         // First check whether the import name matches
         // a definition in the project scope.
         ASProjectScope projectScope = (ASProjectScope)project.getScope();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/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 f1d9e46..8250bdd 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
@@ -358,6 +358,7 @@ public class IdentifierNode extends ExpressionNodeBase implements IIdentifierNod
             ExpressionNodeBase base = getBaseExpression();
 
             String packageName = base.computeSimpleReference();
+            packageName = project.getActualPackageName(packageName);
             Workspace workspace = (Workspace)project.getWorkspace();
             qualifier = workspace.getPackageNamespaceDefinitionCache().get(packageName, false);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/16dd74e7/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java b/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java
index 1cd1290..3cd9349 100644
--- a/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java
+++ b/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java
@@ -27,6 +27,7 @@ import org.apache.flex.compiler.common.DependencyTypeSet;
 import org.apache.flex.compiler.constants.IASLanguageConstants;
 import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.internal.scopes.ASScope;
 import org.apache.flex.compiler.scopes.IASScope;
 import org.apache.flex.compiler.targets.ISWFTarget;
 import org.apache.flex.compiler.targets.ITargetProgressMonitor;
@@ -188,4 +189,22 @@ public interface ICompilerProject
      * @return true if inlining enabled, false otherwise.
      */
     boolean isInliningEnabled();
+
+    /**
+     * Override this to permit package aliasing on imports and elsewhere
+     * 
+     * @param packageName The imported class
+     */
+    String getActualPackageName(String packageName);
+
+    /**
+     * Override this to do try harder to disambiguate between two ambiguous definitions
+     * 
+     * @param scope The current scope.
+     * @param name Definition name.
+     * @param def1 One possibility.
+     * @param def2 The other possibility.
+     * @return null if still ambiguous or else def1 or def2.
+     */
+    IDefinition doubleCheckAmbiguousDefinition(ASScope scope, String name, IDefinition def1, IDefinition def2);
 }


Mime
View raw message