Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using AXSharp.Compiler.Cs.Helpers;
using AXSharp.Connector;


namespace AXSharp.Compiler.Cs;

/// <summary>
Expand Down Expand Up @@ -76,15 +77,26 @@ public static ITypeDeclaration FindTypeDeclaration(this Compilation compilation,
return candidates.First();
}

if (candidates.Count() == 0)
try
{
Log.Logger.Warning($"Type '{typeAccess?.ToString()}' not found in the semantic tree.");
}
var span = typeAccess?.Location?.GetLineSpan();
var line = span.Value.StartLinePosition.Line;
var character = span.Value.StartLinePosition.Character;
if (candidates.Count() == 0)
{
Log.Logger.Warning($"{span?.Filename}({line}:{character}) : Type '{typeAccess.TypeSymbol.Name}' not found the type may not be eligible for transpile or meta information is not available because this type is not defined in AX# compliant project. ");
}

if (candidates.Count() > 1)
if (candidates.Count() > 1)
{
Log.Logger.Warning($"{span?.Filename}({line}:{character}) : Multiple types found for '{typeAccess.TypeSymbol.Name}' the declaration appears ambiguous. You may need to fully qualify the declaration.");
}
}
catch
{
Log.Logger.Warning($"Multiple types found for '{typeAccess?.ToString()}' in the semantic tree. You may need to fully qualify the declaration.");
Log.Logger.Warning($"Failed to determine the location of the type declaration for `{typeAccess?.TypeSymbol?.Name}`.");
}


return null;
}
Expand Down Expand Up @@ -113,7 +125,7 @@ public static ITypeDeclaration FindTypeDeclaration(this Compilation compilation,

if (candidates.Count() == 0)
{
Log.Logger.Warning($"Type '{typeAccess?.ToString()}' not found in the semantic tree.");
Log.Logger.Warning($"Type '{typeAccess?.ToString()}' not found in the semantic tree. {typeAccess?.Location}");
}

if (candidates.Count() > 1)
Expand Down
4 changes: 2 additions & 2 deletions src/AXSharp.compiler/src/ixc/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"workingDirectory": "c:\\W\\Develop\\gh\\inxton\\axopen\\src\\integrations\\ctrl\\"
},
"ixc-simple-template": {
"commandName": "Project",
"commandLineArgs": "--skip-deps",
"commandName": "Project",
"workingDirectory": "C:\\W\\Develop\\gh\\inxton\\simatic-ax\\axopen.templates\\axopen.template.simple\\ax"
},
"ixc-template-ref": {
"commandName": "Project",
"commandLineArgs": "--skip-deps",
"workingDirectory": "C:\\W\\Develop\\gh\\inxton\\axopen\\src\\templates.simple\\ctrl"
},
"ax-connectors-test-project": {
Expand Down