Skip to content

Commit d846968

Browse files
committed
Refactor eligibility checks in SemanticsHelpers to include interface type validation
- Updated IsEligibleForTranspile method to check for IInterfaceDeclaration in addition to IReferenceTypeDeclaration. - Enhanced type declaration retrieval logic for field and variable declarations. - Modified eligibility checks for array type declarations to improve type handling. - Added new launchSettings.json configuration for 'cc' command with specific working directory and arguments.
1 parent dbf3c2d commit d846968

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ private static bool IsToBeOmitted(this IStorageDeclaration fieldDeclaration, ISo
252252
/// <param name="warnMissingOrInconsistent">Issues warning when the type is eligible but not available.</param>
253253
/// <returns>True when the type is eligible</returns>
254254
private static (bool isEligibe, ITypeDeclaration eligibleType) IsEligibleForTranspile(this IFieldDeclaration fieldDeclaration, ISourceBuilder sourceBuilder, bool warnMissingOrInconsistent = false)
255-
{
256-
var type = fieldDeclaration.Type;
255+
{
257256
var fullyQualified = sourceBuilder.Compilation.FindTypeDeclaration(fieldDeclaration.TypeAccess, warnMissingOrInconsistent);
258-
var isEligible = !(type is IReferenceTypeDeclaration)
257+
var type = fullyQualified?.Type;
258+
var isEligible = !(type is IReferenceTypeDeclaration) && !(type is IInterfaceDeclaration)
259259
&&
260260
fieldDeclaration.IsAvailableForComm(sourceBuilder)
261261
&&
@@ -285,7 +285,8 @@ private static (bool isEligibe, ITypeDeclaration? eligibleType) IsEligibleForTra
285285
{
286286
var type = variableDeclaration.Type;
287287
var declaration = sourceBuilder.Compilation.FindTypeDeclaration(variableDeclaration.TypeAccess, warnMissingOrInconsistent);
288-
var isEligible = !(type is IReferenceTypeDeclaration)
288+
type = declaration?.Type;
289+
var isEligible = !(type is IReferenceTypeDeclaration) && !(type is IInterfaceDeclaration)
289290
&&
290291
variableDeclaration.IsAvailableForComm(sourceBuilder)
291292
&&
@@ -317,7 +318,7 @@ public static (bool isEligibe, ITypeDeclaration? eligibleType) IsEligibleForTran
317318
{
318319
var singleDimensionalArray = arrayTypeDeclaration.Dimensions.Count == 1;
319320
var declaration = sourceBuilder.Compilation.FindTypeDeclaration(arrayTypeDeclaration.ElementTypeAccess, warnMissingOrInconsistent);
320-
var isEligibleType = !(arrayTypeDeclaration.ElementTypeAccess.Type is IReferenceTypeDeclaration)
321+
var isEligibleType = !(arrayTypeDeclaration.ElementTypeAccess.Type is IReferenceTypeDeclaration) && !(arrayTypeDeclaration.ElementTypeAccess.Type is IInterfaceDeclaration)
321322
&&
322323
arrayTypeDeclaration.IsAvailableForComm(sourceBuilder)
323324
&&

src/AXSharp.compiler/src/ixc/Properties/launchSettings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
"commandName": "Project",
6161
"commandLineArgs": "--verbosity Information",
6262
"workingDirectory": "c:\\W\\Develop\\gh\\inxton\\simatic-ax\\RANGAROK\\ST20\\ax\\"
63+
},
64+
"cc": {
65+
"commandName": "Project",
66+
"commandLineArgs": "--skip-deps",
67+
"workingDirectory": "c:\\W\\Develop\\gh\\inxton\\simatic-ax\\ppppppsjsjsjs\\MTS258585\\ax\\"
6368
}
6469
}
6570
}

0 commit comments

Comments
 (0)