From 75739793dcf2091459578d4d5b87935c4694d2e6 Mon Sep 17 00:00:00 2001 From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com> Date: Thu, 4 Dec 2025 06:52:36 +0100 Subject: [PATCH 1/4] Create draft PR for #477 From 3033257b14c3167fdd3458f5d56b7cef05777002 Mon Sep 17 00:00:00 2001 From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com> Date: Thu, 4 Dec 2025 07:25:59 +0100 Subject: [PATCH 2/4] Improve logging, error handling, and update paths Replaced `NotImplementedException` in `ICombinedThreeVisitor`'s `CreateMergedConfigurations` method with an informational log message. Enhanced `IxNodeVisitor` to log warnings for unsupported array type declarations, including file location when available. Updated `launchSettings.json` to reflect a new working directory path for the `axopen-traversal` configuration. --- .../Core/ICombinedThreeVisitor.cs | 2 +- .../src/AXSharp.Compiler/Core/IxNodeVisitor.cs | 17 ++++++++++++++++- .../src/ixc/Properties/launchSettings.json | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs index adf28f4e..ab1db94c 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs @@ -22,7 +22,7 @@ public interface ICombinedThreeVisitor { public virtual void CreateMergedConfigurations(IxNodeVisitor visitor, Compilation compilation) { - throw new NotImplementedException(); + Log.Logger.Information("Merging configurations..."); } diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs index d4d6117f..da6138e2 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs @@ -743,7 +743,22 @@ public void Accept(IArrayRepetitionInitializerSyntax arrayRepetitionInitializerS void ISyntaxNodeVisitor.Accept(IArrayTypeDeclarationSyntax arrayTypeDeclarationSyntax, ICombinedThreeVisitor data) { - throw new NotSupportedException(); + try + { + // Read Locations SourceText property using reflection. + var locationType = arrayTypeDeclarationSyntax.Location.GetType(); + var sourceTextProperty = locationType.GetProperty("SourceText"); + var sourceText = sourceTextProperty?.GetValue(arrayTypeDeclarationSyntax.Location); + var sourceTextType = sourceText?.GetType(); + var fileNameProperty = sourceTextType?.GetProperty("Filename") ?? sourceTextType?.GetProperty("FileName"); + var fileName = fileNameProperty?.GetValue(sourceText) as string ?? "unknown file"; + + Log.Logger.Warning($"Array types as declared in '{fileName}' are not supported at this time."); + } + catch (Exception) + { + Log.Logger.Warning($"Array types as declared in 'an unknown location' are not supported at this time."); + } } void ISyntaxNodeVisitor.Accept(IAsmStatementSyntax asmStatementSyntax, diff --git a/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json b/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json index c9a09360..03c4a8d4 100644 --- a/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json +++ b/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json @@ -40,7 +40,7 @@ "axopen-traversal": { "commandName": "Project", "commandLineArgs": "--verbosity Information", - "workingDirectory": "C:\\W\\Develop\\gh\\inxton\\simatic-ax\\axopen.templates\\axopen\\src\\traversals\\apax\\" + "workingDirectory": "c:\\W\\Develop\\gh\\inxton\\simatic-ax\\axopen-1\\AXOpen\\src\\traversals\\apax\\" }, "axopen-core": { "commandName": "Project", From afa5f8e3c9cf6d9005649ce401c338738f381937 Mon Sep 17 00:00:00 2001 From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com> Date: Thu, 4 Dec 2025 07:39:39 +0100 Subject: [PATCH 3/4] Refactor CreateMergedConfigurations method Replaced the logging statement in the `CreateMergedConfigurations` method of the `ICombinedThreeVisitor` interface with a `throw new NotImplementedException();`. This change explicitly marks the method as unimplemented, ensuring it raises an exception if invoked. --- .../src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs index ab1db94c..adf28f4e 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/ICombinedThreeVisitor.cs @@ -22,7 +22,7 @@ public interface ICombinedThreeVisitor { public virtual void CreateMergedConfigurations(IxNodeVisitor visitor, Compilation compilation) { - Log.Logger.Information("Merging configurations..."); + throw new NotImplementedException(); } From 82ff85e32ef958a929b4d5b95c0b02066c9b25a7 Mon Sep 17 00:00:00 2001 From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com> Date: Thu, 4 Dec 2025 07:48:52 +0100 Subject: [PATCH 4/4] Remove NotSupportedException assertion in Accept test The test for the `Accept` method no longer asserts that a `NotSupportedException` is thrown. The `Assert.Throws` call was replaced with a direct invocation of the `Accept` method, indicating that the method is no longer expected to throw this exception in the given context. --- .../AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs index eed4d073..da4709ea 100644 --- a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs +++ b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs @@ -921,7 +921,7 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithArrayTy var data = new Mock().Object; // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(arrayTypeDeclarationSyntax, data)); + ((ISyntaxNodeVisitor)_testClass).Accept(arrayTypeDeclarationSyntax, data); // Assert