flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [11/50] git commit: [flex-falcon] [refs/heads/master] - compiler-jx: source map directive is output for MXML files
Date Mon, 26 Jun 2017 15:44:51 GMT
compiler-jx: source map directive is output for MXML files


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

Branch: refs/heads/master
Commit: 3afd5d4f29b57843dc6716bc812df2b9bf6ba6d1
Parents: faec4e0
Author: Josh Tynjala <joshtynjala@apache.org>
Authored: Mon May 8 15:54:57 2017 -0700
Committer: Josh Tynjala <joshtynjala@apache.org>
Committed: Mon May 8 15:54:57 2017 -0700

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/IMXMLFlexJSEmitter.java       |  4 ++--
 .../codegen/js/jx/SourceMapDirectiveEmitter.java      | 14 +++++++++++++-
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java        | 11 +++++++++++
 3 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3afd5d4f/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/mxml/flexjs/IMXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/mxml/flexjs/IMXMLFlexJSEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/mxml/flexjs/IMXMLFlexJSEmitter.java
index 333aa00..3c899c4 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/mxml/flexjs/IMXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/mxml/flexjs/IMXMLFlexJSEmitter.java
@@ -22,6 +22,7 @@ package org.apache.flex.compiler.codegen.mxml.flexjs;
 import java.io.Writer;
 
 import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.tree.as.ITypeNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
 import org.apache.flex.compiler.visitor.IASNodeStrategy;
 
@@ -33,7 +34,6 @@ import org.apache.flex.compiler.visitor.IASNodeStrategy;
  */
 public interface IMXMLFlexJSEmitter extends IMXMLEmitter
 {
-
     void emitDocument(IMXMLDocumentNode node);
-
+    void emitSourceMapDirective(ITypeNode node);
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3afd5d4f/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
index 14674de..4bf158f 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
@@ -25,11 +25,17 @@ import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.tree.as.ITypeNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
 import org.apache.flex.compiler.visitor.IBlockWalker;
 
 public class SourceMapDirectiveEmitter extends JSSubEmitter implements
         ISubEmitter<ITypeNode>
 {
+    private static final String SOURCE_MAP_PREFIX = "//# sourceMappingURL=./";
+    private static final String EXTENSION_JS = ".js";
+    private static final String EXTENSION_MXML = ".mxml";
+    private static final String EXTENSION_MAP = ".map";
+    
     public SourceMapDirectiveEmitter(IJSEmitter emitter)
     {
         super(emitter);
@@ -53,8 +59,14 @@ public class SourceMapDirectiveEmitter extends JSSubEmitter implements
 
         if (sourceMap)
         {
+            String name = node.getName() + EXTENSION_JS;
+            if (node instanceof IMXMLDocumentNode)
+            {
+                IMXMLDocumentNode mxmlNode = (IMXMLDocumentNode) node;
+                name = mxmlNode.getFileNode().getName() + EXTENSION_MXML;
+            }
             writeNewline();
-            write("//# sourceMappingURL=./" + node.getName() + ".js.map");
+            write(SOURCE_MAP_PREFIX + name + EXTENSION_MAP);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3afd5d4f/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 0fbf7ac..e41daf8 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -35,6 +35,7 @@ import org.apache.flex.abc.semantics.Name;
 import org.apache.flex.abc.semantics.Namespace;
 import org.apache.flex.compiler.codegen.IEmitterTokens;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.codegen.js.IMappingEmitter;
 import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
 import org.apache.flex.compiler.common.ASModifier;
@@ -576,6 +577,8 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         emitBindingData(cname, cdef);
 
         emitMetaData(cdef);
+
+        emitSourceMapDirective(node);
     }
 
     public void emitSubDocument(IMXMLComponentNode node)
@@ -684,6 +687,14 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         metadataNodes.add(node);
     }
 
+    @Override
+    public void emitSourceMapDirective(ITypeNode node)
+    {
+        IMXMLBlockWalker walker = (IMXMLBlockWalker) getMXMLWalker();
+        IJSEmitter jsEmitter = (IJSEmitter) walker.getASEmitter();
+        jsEmitter.emitSourceMapDirective(node);
+    }
+
     //--------------------------------------------------------------------------
 
     protected void emitClassDeclStart(String cname, String baseClassName,


Mime
View raw message