You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/09/14 21:48:33 UTC

[royale-compiler] branch develop updated: fix sourcemap for MXML files inside packages

This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/develop by this push:
     new def5465  fix sourcemap for MXML files inside packages
def5465 is described below

commit def5465dd45fccf7f527af934a15dc9ad7b8ee9d
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Fri Sep 14 23:48:26 2018 +0200

    fix sourcemap for MXML files inside packages
---
 .../compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
index fe51b73..4109f1e 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
@@ -62,7 +62,10 @@ public class SourceMapDirectiveEmitter extends JSSubEmitter implements
             if (node instanceof IMXMLDocumentNode)
             {
                 IMXMLDocumentNode mxmlNode = (IMXMLDocumentNode) node;
-                name = mxmlNode.getFileNode().getName() + EXTENSION_JS;
+                String pname = mxmlNode.getFileNode().getName();
+                // in MXML inside packages getName brings the whole package. We need to strip packages and get only the Class name for sourceMaps
+                String lastToken = pname.substring(pname.lastIndexOf(".") + 1);
+                name = lastToken + EXTENSION_JS;
             }
             writeNewline();
             write(SOURCE_MAP_PREFIX + name + EXTENSION_MAP);