Small fix to JS emitter and the addition of 'org.apache.flex.utils.Language' 
emission to the MXML emitter.

Signed-off-by: Erik de Bruin <e...@ixsoftware.nl>


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

Branch: refs/heads/develop
Commit: 1d2d36cc9223672143e0f0a39e9823d94a03c221
Parents: 8b36845
Author: Erik de Bruin <e...@ixsoftware.nl>
Authored: Fri Nov 1 10:33:38 2013 +0100
Committer: Erik de Bruin <e...@ixsoftware.nl>
Committed: Fri Nov 1 12:32:58 2013 +0100

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 24 ++++++++------------
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 22 ++++++++++++++++--
 2 files changed, 30 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1d2d36cc/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 4110e79..60460fc 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
@@ -34,7 +34,6 @@ import org.apache.flex.compiler.common.ModifiersSet;
 import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.definitions.IFunctionDefinition;
 import 
org.apache.flex.compiler.definitions.IFunctionDefinition.FunctionClassification;
-import org.apache.flex.compiler.definitions.IInterfaceDefinition;
 import org.apache.flex.compiler.definitions.INamespaceDefinition;
 import org.apache.flex.compiler.definitions.IPackageDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
@@ -873,20 +872,17 @@ public class JSFlexJSEmitter extends JSGoogEmitter 
implements IJSFlexJSEmitter
         //              'as' operators. We don't need to worry about requiring
         //              this in every project: ADVANCED_OPTIMISATIONS will NOT
         //              include any of the code if it is not used in the 
project.
-        if (flexProject.mainCU != null)
+        if (flexProject.mainCU != null && 
+                cu.getName().equals(flexProject.mainCU.getName()))
         {
-            if (!(type instanceof IInterfaceDefinition) && 
-                    cu.getName().equals(flexProject.mainCU.getName()))
-            {
-                write(JSGoogEmitterTokens.GOOG_REQUIRE);
-                write(ASEmitterTokens.PAREN_OPEN);
-                write(ASEmitterTokens.SINGLE_QUOTE);
-                write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
-                write(ASEmitterTokens.SINGLE_QUOTE);
-                write(ASEmitterTokens.PAREN_CLOSE);
-                writeNewline(ASEmitterTokens.SEMICOLON);
-                writeNewline();
-            }
+            write(JSGoogEmitterTokens.GOOG_REQUIRE);
+            write(ASEmitterTokens.PAREN_OPEN);
+            write(ASEmitterTokens.SINGLE_QUOTE);
+            write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+            write(ASEmitterTokens.SINGLE_QUOTE);
+            write(ASEmitterTokens.PAREN_CLOSE);
+            writeNewline(ASEmitterTokens.SEMICOLON);
+            writeNewline();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1d2d36cc/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 29b78ca..7669e81 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
@@ -23,8 +23,8 @@ package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
 import java.io.FilterWriter;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import org.apache.flex.abc.semantics.MethodInfo;
 import org.apache.flex.abc.semantics.Name;
@@ -39,9 +39,10 @@ import 
org.apache.flex.compiler.internal.codegen.databinding.BindingInfo;
 import 
org.apache.flex.compiler.internal.codegen.databinding.FunctionWatcherInfo;
 import 
org.apache.flex.compiler.internal.codegen.databinding.PropertyWatcherInfo;
 import org.apache.flex.compiler.internal.codegen.databinding.WatcherInfoBase;
-import org.apache.flex.compiler.internal.codegen.databinding.XMLWatcherInfo;
 import 
org.apache.flex.compiler.internal.codegen.databinding.WatcherInfoBase.WatcherType;
+import org.apache.flex.compiler.internal.codegen.databinding.XMLWatcherInfo;
 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.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.mxml.MXMLEmitter;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
@@ -1354,6 +1355,23 @@ public class MXMLFlexJSEmitter extends MXMLEmitter 
implements
                 }
             }
         }
+
+        // erikdebruin: Add missing language feature support, like the 'is' 
and 
+        //              'as' operators. We don't need to worry about requiring
+        //              this in every project: ADVANCED_OPTIMISATIONS will NOT
+        //              include any of the code if it is not used in the 
project.
+        if (project.mainCU != null &&
+                cu.getName().equals(project.mainCU.getName()))
+        {
+            write(JSGoogEmitterTokens.GOOG_REQUIRE);
+            write(ASEmitterTokens.PAREN_OPEN);
+            write(ASEmitterTokens.SINGLE_QUOTE);
+            write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+            write(ASEmitterTokens.SINGLE_QUOTE);
+            write(ASEmitterTokens.PAREN_CLOSE);
+            writeNewline(ASEmitterTokens.SEMICOLON);
+            writeNewline();
+        }
     }
 
     private void emitHeaderLine(String qname)

Reply via email to