You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/03/19 16:58:00 UTC

[royale-compiler] 02/02: report filename correctly for . Line number is off by one still

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

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

commit f86cc274065fcb3857c3ce5fae778cff7a4f72c2
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Mar 19 09:57:46 2018 -0700

    report filename correctly for <fx:Style src='somefile.css'/>.  Line number is off by one still
---
 .../royale/compiler/internal/tree/mxml/MXMLStyleNode.java     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLStyleNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLStyleNode.java
index de1b7a7..038f034 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLStyleNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLStyleNode.java
@@ -63,6 +63,12 @@ class MXMLStyleNode extends MXMLNodeBase implements IMXMLStyleNode
      * {@code <fx:Style src="styles.css" />}.
      */
     private String cssText;
+    
+    /**
+     * path of included css.
+     * {@code <fx:Style src="styles.css" />}.
+     */
+    private String cssSourcePath = null;
 
     @Override
     public ASTNodeID getNodeID()
@@ -84,7 +90,7 @@ class MXMLStyleNode extends MXMLNodeBase implements IMXMLStyleNode
             if (cssText != null && !cssText.isEmpty() && !cssText.trim().isEmpty())
             {
                 ANTLRStringStream stream = new ANTLRStringStream(cssText);
-                stream.name = getSourcePath();
+                stream.name = cssSourcePath != null ? cssSourcePath : getSourcePath();
                 cssDocument = CSSDocument.parse(stream, problems);
             }
             else
@@ -114,7 +120,10 @@ class MXMLStyleNode extends MXMLNodeBase implements IMXMLStyleNode
             // Doing so makes this compilation unit dependent on that file.
             final String sourcePath = resolveSourceAttributePath(builder, attribute, info);
             if (sourcePath != null)
+            {
                 cssText = builder.readExternalFile(attribute, sourcePath);
+                cssSourcePath = sourcePath;
+            }
         }
         else
         {

-- 
To stop receiving notification emails like this one, please contact
aharui@apache.org.