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

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

commit 938a99fb4abea1a0a9504a2ddf1a4dd11a37842d
Author: Josh Tynjala <[email protected]>
AuthorDate: Wed May 18 10:34:14 2022 -0700

    formatter: better MXML script file path in syntax errors
---
 formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java 
b/formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java
index e93a773dc..57cc0220c 100644
--- a/formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java
+++ b/formatter/src/main/java/org/apache/royale/formatter/FORMATTER.java
@@ -393,7 +393,7 @@ public class FORMATTER {
                }
        }
 
-       private String formatMXMLScriptElement(String text, 
Collection<ICompilerProblem> problems) {
+       private String formatMXMLScriptElement(String filePath, int line, 
String text, Collection<ICompilerProblem> problems) {
                String indent = "\t";
                if (insertSpaces) {
                        indent = "";
@@ -418,7 +418,7 @@ public class FORMATTER {
                String cdataText = scriptMatcher.group(3);
                String scriptText = scriptMatcher.group(4);
                boolean requireCdata = cdataText != null || 
"Script".equals(scriptTagName);
-               String formattedScriptText = formatAS3TextInternal("script.as", 
scriptText, problems);
+               String formattedScriptText = formatAS3TextInternal(filePath + 
"@Script[" + line + "]", scriptText, problems);
                if (!ignoreProblems && hasErrors(problems)) {
                        return text;
                }
@@ -1860,7 +1860,7 @@ public class FORMATTER {
                                        // need to return the original, 
unformatted text
                                        problems = new 
ArrayList<ICompilerProblem>();
                                }
-                               
builder.append(formatMXMLScriptElement(scriptBuilder.toString(), problems));
+                               
builder.append(formatMXMLScriptElement(filePath, token.getLine(), 
scriptBuilder.toString(), problems));
                                if (hasErrors(problems)) {
                                        return text;
                                }

Reply via email to