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 2745365c49853e71e1e4eb65ffdc48555ec6958d
Author: Josh Tynjala <[email protected]>
AuthorDate: Thu Oct 17 13:54:41 2024 -0700

    formatter, linter: when creating a new ASParser, pass the file path to 
avoid exceptions where it is expected to be non-null
---
 .../src/main/java/org/apache/royale/formatter/ASTokenFormatter.java      | 1 +
 linter/src/main/java/org/apache/royale/linter/ASLinter.java              | 1 +
 2 files changed, 2 insertions(+)

diff --git 
a/formatter/src/main/java/org/apache/royale/formatter/ASTokenFormatter.java 
b/formatter/src/main/java/org/apache/royale/formatter/ASTokenFormatter.java
index 4cf87a6d5..817ab41d6 100644
--- a/formatter/src/main/java/org/apache/royale/formatter/ASTokenFormatter.java
+++ b/formatter/src/main/java/org/apache/royale/formatter/ASTokenFormatter.java
@@ -128,6 +128,7 @@ public class ASTokenFormatter extends BaseTokenFormatter {
                Workspace workspace = new Workspace();
                RepairingTokenBuffer buffer = new 
RepairingTokenBuffer(streamingTokensList.toArray(new ASToken[0]));
                ASParser parser = new ASParser(workspace, buffer);
+               parser.setFilename(filePath);
                FileNode node = new FileNode(workspace);
                try {
                        parser.file(node);
diff --git a/linter/src/main/java/org/apache/royale/linter/ASLinter.java 
b/linter/src/main/java/org/apache/royale/linter/ASLinter.java
index c6b46f043..8b453de8b 100644
--- a/linter/src/main/java/org/apache/royale/linter/ASLinter.java
+++ b/linter/src/main/java/org/apache/royale/linter/ASLinter.java
@@ -99,6 +99,7 @@ public class ASLinter extends BaseLinter {
                        Workspace workspace = new Workspace();
                        RepairingTokenBuffer buffer = new 
RepairingTokenBuffer(streamingTokensList.toArray(new ASToken[0]));
                        ASParser parser = new ASParser(workspace, buffer);
+                       parser.setFilename(filePath);
                        FileNode node = new FileNode(workspace);
                        try {
                                parser.parseFile(node, 
EnumSet.of(PostProcessStep.CALCULATE_OFFSETS));

Reply via email to