diff --git a/GitVersion.yml b/GitVersion.yml index b2c9a381..ce5d2de1 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,5 @@ mode: ContinuousDeployment -next-version: 0.19.1 +next-version: 0.19.0 branches: main: regex: ^master$|^main$ diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharp.Compiler.csproj b/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharp.Compiler.csproj index 8897c2b4..7ea22bf3 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharp.Compiler.csproj +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharp.Compiler.csproj @@ -61,14 +61,15 @@ - - - - - - - - + + + + + + + + + @@ -88,6 +89,11 @@ ..\..\..\apax\stc\bin\AX.Text.dll False + + + ..\..\..\apax\stc\bin\AX.ST.Compiler.PluginAbstractions.dll + False + \ No newline at end of file diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs index dfc86d35..3a8de01d 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/AXSharpProject.cs @@ -8,6 +8,7 @@ using System.Text; using System.Xml.Linq; using AX.ST.Semantic; +using AX.ST.Semantic.Analyzer; using AX.ST.Semantic.Model.Declarations; using AX.ST.Semantic.Model.Declarations.Types; using AX.ST.Syntax.Parser; @@ -92,8 +93,8 @@ public void Generate() var toCompile = refParseTrees.Concat(projectSources.Select(p => p.parseTree)); - var compilation = Compilation.Create(toCompile, Compilation.Settings.Default).Result; - + var compilationResult = Compilation.Create(toCompile, new List(), Compilation.Settings.Default).Result; + this.CleanOutput(this.OutputFolder); foreach (var origin in projectSources) @@ -102,7 +103,7 @@ public void Generate() foreach (var sourceBuilderType in BuilderTypes) { - var builder = Activator.CreateInstance(sourceBuilderType, this, compilation); + var builder = Activator.CreateInstance(sourceBuilderType, this, compilationResult.Compilation); var treeWalker = builder as ICombinedThreeVisitor; var sourceBuilder = builder as ISourceBuilder; @@ -115,7 +116,7 @@ public void Generate() $"Could not create {sourceBuilderType.Name} as ISourceBuilder"); - origin.parseTree.GetRoot().Visit(new IxNodeVisitor(compilation), treeWalker); + origin.parseTree.GetRoot().Visit(new IxNodeVisitor(compilationResult.Compilation), treeWalker); @@ -135,7 +136,7 @@ public void Generate() } TargetProject.ProvisionProjectStructure(); - GenerateMetadata(compilation); + GenerateMetadata(compilationResult.Compilation); TargetProject.GenerateResources(); TargetProject.GenerateCompanionData(); Log.Logger.Information($"Compilation of project '{AxProject.SrcFolder}' done."); @@ -334,26 +335,26 @@ private static string CreateMetaType(ITypeDeclaration type) var hasNamespace = type.ContainingNamespace != null; - if (hasNamespace) sb.Append($"NAMESPACE {type.ContainingNamespace!.FullyQualifiedName}\n"); + if (hasNamespace) sb.Append($"NAMESPACE {type.ContainingNamespace!.FullyQualifiedName}\n\n"); - type?.Pragmas?.ToList().ForEach(p => sb.Append($"{{{p.Content}}}")); + type?.Pragmas?.ToList().ForEach(p => sb.Append($"{{{p.Content}}}\n")); switch (kind) { case DeclarationKind.Struct: - sb.Append($"TYPE {type.Name} : STRUCT ; END_STRUCT"); + sb.Append($"TYPE {type.Name} : STRUCT ; END_STRUCT\n"); break; case DeclarationKind.Class: - sb.Append($"CLASS {type.Name} END_CLASS"); + sb.Append($"CLASS {type.Name} \nEND_CLASS\n"); break; case DeclarationKind.Enumeration: - sb.Append($"TYPE {type.Name} : (item0); END_TYPE"); + sb.Append($"TYPE {type.Name} : (item0); \nEND_TYPE\n"); break; case DeclarationKind.Interface: - sb.Append($"INTERFACE {type.Name} END_INTERFACE"); + sb.Append($"INTERFACE {type.Name} \nEND_INTERFACE\n"); break; case DeclarationKind.NamedValueType: - sb.Append($"TYPE {type.Name} : INT (item0 := 0); END_TYPE"); + sb.Append($"TYPE {type.Name} : INT (item0 := 0); \nEND_TYPE\n"); break; } diff --git a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs index 57fdc2ce..84ad9683 100644 --- a/src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs +++ b/src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs @@ -39,12 +39,12 @@ public partial class IxNodeVisitor : ISemanticNodeVisitor void ISemanticNodeVisitor.Visit(IPartialSemanticTree partialSemanticTree, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISymbol symbol, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IPragma pragma, ICombinedThreeVisitor data) @@ -61,35 +61,35 @@ void ISemanticNodeVisitor.Visit(IConfigurationDeclaration void ISemanticNodeVisitor.Visit(ITaskConfigurationDeclaration taskConfigurationDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ITaskDeclaration taskDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit( IProgramConfigurationDeclaration programConfigurationDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(INamespaceDeclaration namespaceDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IUsingDirective usingDirective, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IProgramDeclaration programDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IClassDeclaration classDeclaration, @@ -107,25 +107,25 @@ void ISemanticNodeVisitor.Visit(IInterfaceDeclaration int void ISemanticNodeVisitor.Visit(IFunctionDeclaration functionDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IFunctionBlockDeclaration functionBlockDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IMethodDeclaration methodDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IMethodPrototypeDeclaration methodPrototypeDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IScalarTypeDeclaration scalarTypeDeclaration, @@ -172,7 +172,7 @@ void ISemanticNodeVisitor.Visit(IStringTypeDeclaration st void ISemanticNodeVisitor.Visit(IDimension dimension, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IFieldDeclaration fieldDeclaration, @@ -190,37 +190,37 @@ void ISemanticNodeVisitor.Visit(IVariableDeclaration vari void ISemanticNodeVisitor.Visit(IEnumValueDeclaration enumValueDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(INamedValueDeclaration namedValueDeclaration, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticInitializerExpression initializerExpression, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticArrayInitializer arrayInitializer, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticStructureInitializer structureInitializer, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticMemberInitializer memberInitializer, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticTypeAccess semanticTypeAccess, @@ -237,166 +237,162 @@ public void Visit(IDocComment semanticTypeAccess, ICombinedThreeVisitor data) void ISemanticNodeVisitor.Visit(ISemanticInstructionList instrList, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticAssignmentInstruction assignment, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticUnsafeAssignmentInstruction assignment, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticAssignmentAttemptInstruction assignmentAttempt, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticExpressionInstruction expression, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticIfConditionalStatement condStatement, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IConditionalInstructionList condInstrList, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticCaseStatement caseStatement, ICombinedThreeVisitor data) { - throw new NotImplementedException(); - } - - void ISemanticNodeVisitor.Visit(ISemanticCaseSelection caseSelection, - ICombinedThreeVisitor data) - { - throw new NotImplementedException(); + throw new NotSupportedException(); } + + void ISemanticNodeVisitor.Visit(ISemanticSubrange subrange, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticForStatement forStatement, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticWhileStatement whileStatement, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticRepeatStatement repeatStatement, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticContinueInstruction continueInstruction, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticExitInstruction exitInstruction, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticReturnStatement returnStatement, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticAsmStatement asmStatement, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticConstantExpression constExpr, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticIdentifierAccess identifierAccess, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticBinaryExpression binExpr, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticUnaryExpression unaryExpression, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticQualifiedEnumAccess qualifiedEnumAccess, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticMemberAccessExpression memberAccessExpression, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticArrayAccessExpression arrayAccessExpression, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticCallExpression call, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticParameterList paramList, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(ISemanticParameterAssignment paramAssignment, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISemanticNodeVisitor.Visit(IPartialAccessExpression partialAccessExpression, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } } @@ -486,6 +482,11 @@ void ISyntaxNodeVisitor.Accept(IEnumTypeDeclarationSyntax data.CreateEnumTypeDeclaration(enumTypeDeclarationSyntax, semantics, this); } + public void Accept(IEnumValueListSyntax enumValueListSyntax, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } + void ISyntaxNodeVisitor.Accept( INamedValueTypeDeclarationSyntax namedValueTypeDeclarationSyntax, ICombinedThreeVisitor data) @@ -520,9 +521,11 @@ void ISyntaxNodeVisitor.Accept(IStructTypeDeclarationSynt private string GetFullyQualifiedNameFromCurrentSyntaxTree(string typeName) { - return string.IsNullOrEmpty(_containingNamespace.Replace('|', '.')) + var qualified = string.IsNullOrEmpty(_containingNamespace.Replace('|', '.')) ? typeName : $"{_containingNamespace}.{typeName}"; + + return qualified.Replace("|", "."); } #region NotImplemented @@ -589,45 +592,35 @@ void ISyntaxNodeVisitor.Accept(IUserDeclaredTypeSyntax us throw new NotSupportedException("Uses semantics"); } - - void ISyntaxNodeVisitor.Accept(IPragmaSyntax pragmaSyntax, ICombinedThreeVisitor data) - { - throw new NotSupportedException("Uses semantics"); - } - - void ISyntaxNodeVisitor.Accept(IExpressionInitializerSyntax expressionInitializerSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(ILiteralSyntax literalSyntax, ICombinedThreeVisitor data) + public void Accept(IExpressionPrefixStatementSyntax expressionPrefixStatementSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } - - void ISyntaxNodeVisitor.Accept(IExtendsListSyntax extendsListSyntax, - ICombinedThreeVisitor data) + void ISyntaxNodeVisitor.Accept(ILiteralSyntax literalSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(ITaskDeclarationSyntax taskDeclarationSyntax, + void ISyntaxNodeVisitor.Accept(IExtendsListSyntax extendsListSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(ITaskConfigSyntax taskConfigSyntax, + void ISyntaxNodeVisitor.Accept(ITaskDeclarationSyntax taskDeclarationSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept( - IAbstractMethodDeclarationSyntax abstractMethodDeclarationSyntax, ICombinedThreeVisitor data) + public void Accept(ITaskInitSpecSyntax taskInitSpecSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } @@ -668,12 +661,6 @@ void ISyntaxNodeVisitor.Accept(IAnonymousReferenceTypeSyn throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(IArgumentExpressionSyntax argumentExpressionSyntax, - ICombinedThreeVisitor data) - { - throw new NotSupportedException(); - } - void ISyntaxNodeVisitor.Accept(IArrayAccessExpressionSyntax arrayAccessExpressionSyntax, ICombinedThreeVisitor data) { @@ -728,6 +715,11 @@ void ISyntaxNodeVisitor.Accept(IArrayInitializerSyntax ar throw new NotSupportedException(); } + public void Accept(IArrayRepetitionInitializerSyntax arrayRepetitionInitializerSyntax, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } + void ISyntaxNodeVisitor.Accept(IArrayTypeDeclarationSyntax arrayTypeDeclarationSyntax, ICombinedThreeVisitor data) { @@ -764,25 +756,7 @@ void ISyntaxNodeVisitor.Accept(ICallExpressionSyntax call throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(ICallParamAssignmentLhsSyntax callParamAssignmentLhsSyntax, - ICombinedThreeVisitor data) - { - throw new NotSupportedException(); - } - - void ISyntaxNodeVisitor.Accept(ICaseListElemSyntax caseListElemSyntax, - ICombinedThreeVisitor data) - { - throw new NotSupportedException(); - } - - void ISyntaxNodeVisitor.Accept(ICaseListSyntax caseListSyntax, ICombinedThreeVisitor data) - { - throw new NotSupportedException(); - } - - void ISyntaxNodeVisitor.Accept(ICaseSelectionSyntax caseSelectionSyntax, - ICombinedThreeVisitor data) + public void Accept(ICaseListStatementSyntax caseListStatementSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } @@ -804,20 +778,14 @@ void ISyntaxNodeVisitor.Accept(ICodeBodySyntax codeBodySy throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(ICommaCaseListElemSyntax commaCaseListElemSyntax, - ICombinedThreeVisitor data) - { - throw new NotSupportedException(); - } - public void Accept(IConditionalAndExpressionSyntax conditionalAndExpressionSyntax, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } public void Accept(IConditionalOrExpressionSyntax conditionalOrExpressionSyntax, ICombinedThreeVisitor data) { - throw new NotImplementedException(); + throw new NotSupportedException(); } void ISyntaxNodeVisitor.Accept(IConditionalStatementSyntax conditionalStatementSyntax, @@ -904,11 +872,6 @@ void ISyntaxNodeVisitor.Accept(IExpressionSyntax expressi throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept( - IExternFunctionDeclarationSyntax externFunctionDeclarationSyntax, ICombinedThreeVisitor data) - { - throw new NotSupportedException(); - } void ISyntaxNodeVisitor.Accept(IForStatementSyntax forStatementSyntax, ICombinedThreeVisitor data) @@ -959,6 +922,11 @@ void ISyntaxNodeVisitor.Accept(IJumpStatementSyntax jumpS throw new NotSupportedException(); } + public void Accept(IKeywordStatementSyntax keywordStatementSyntax, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } + void ISyntaxNodeVisitor.Accept(IListElementSyntax listElementSyntax, ICombinedThreeVisitor data) { @@ -996,13 +964,12 @@ void ISyntaxNodeVisitor.Accept( throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(INamedParamListSyntax namedParamListSyntax, - ICombinedThreeVisitor data) + void ISyntaxNodeVisitor.Accept(INamedTypeSyntax namedTypeSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(INamedTypeSyntax namedTypeSyntax, ICombinedThreeVisitor data) + public void Accept(INamedValueListSyntax namedValueListSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } @@ -1025,6 +992,11 @@ void ISyntaxNodeVisitor.Accept(INamespaceElementSyntax na throw new NotSupportedException(); } + public void Accept(INonReferenceTypeSyntax nonReferenceTypeSyntax, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } + void ISyntaxNodeVisitor.Accept(INotExpressionSyntax notExpressionSyntax, ICombinedThreeVisitor data) { @@ -1090,12 +1062,6 @@ void ISyntaxNodeVisitor.Accept(IProgramDeclarationSyntax // We ignore PROGRAM declarations. } - void ISyntaxNodeVisitor.Accept(IQualifiedEnumAccessSyntax qualifiedEnumAccessSyntax, - ICombinedThreeVisitor data) - { - throw new NotSupportedException(); - } - void ISyntaxNodeVisitor.Accept(IQualifiedIdentifierListSyntax qualifiedIdentifierListSyntax, ICombinedThreeVisitor data) { @@ -1163,12 +1129,6 @@ void ISyntaxNodeVisitor.Accept(IStatementListSyntax state throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(IStatementPartSyntax statementPartSyntax, - ICombinedThreeVisitor data) - { - throw new NotSupportedException(); - } - void ISyntaxNodeVisitor.Accept(IStatementSyntax statementSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); @@ -1188,6 +1148,16 @@ void ISyntaxNodeVisitor.Accept(IStructureInitializerSynta throw new NotSupportedException(); } + public void Accept(IStSyntax stSyntax, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } + + public void Accept(ISubCaseListSyntax subCaseListSyntax, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } + void ISyntaxNodeVisitor.Accept(ISuperExpressionSyntax superExpressionSyntax, ICombinedThreeVisitor data) { @@ -1211,6 +1181,11 @@ void ISyntaxNodeVisitor.Accept(ITaskInitSyntax taskInitSy throw new NotSupportedException(); } + public void Accept(ITaskInstanceSyntax taskInstanceSyntax, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } + void ISyntaxNodeVisitor.Accept(IThisAccessSyntax thisAccessSyntax, ICombinedThreeVisitor data) { @@ -1229,8 +1204,7 @@ void ISyntaxNodeVisitor.Accept(ITypeSyntax typeSyntax, IC throw new NotSupportedException(); } - void ISyntaxNodeVisitor.Accept(IUnnamedParamListSyntax unnamedParamListSyntax, - ICombinedThreeVisitor data) + public void Accept(IUnaryArithmeticExpressionSyntax unaryArithmeticExpressionSyntax, ICombinedThreeVisitor data) { throw new NotSupportedException(); } @@ -1266,4 +1240,14 @@ void ISyntaxNodeVisitor.Accept(IXOrExpressionSyntax xOrEx } #endregion + + public void Visit(ISemanticEmptyInstruction emptyInstruction, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } + + public void Visit(ISemanticCaseSelectionStatement caseSelectionStatement, ICombinedThreeVisitor data) + { + throw new NotSupportedException(); + } } \ No newline at end of file diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs index ef00a14c..db28ff7a 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs @@ -54,7 +54,12 @@ public void CreateFile(IFileSyntax fileSyntax, IxNodeVisitor visitor) AddToSource("using AXSharp.Connector.ValueTypes;"); AddToSource("using System.Collections.Generic;"); AddToSource("using AXSharp.Connector.Localizations;"); - + foreach (var fileSyntaxUsingDirective in fileSyntax.UsingDirectives + .Where(p => this.Compilation.GetSemanticTree().Namespaces.Select(p => p.FullyQualifiedName).Contains(p.QualifiedIdentifierList.GetText()))) + { + AddToSource($"using {fileSyntaxUsingDirective.QualifiedIdentifierList.GetText()};"); + } + fileSyntax.Declarations.ToList().ForEach(p => p.Visit(visitor, this)); } @@ -66,7 +71,7 @@ private string ReplaceGenericSignature(IClassDeclaration? classDeclaration) var generics = new List(); var genericSignature = classDeclaration?.ExtendedType?.GetGenericAttributes()?.Product; - if(string.IsNullOrEmpty(genericSignature)) + if (string.IsNullOrEmpty(genericSignature)) { return string.Empty; } @@ -82,11 +87,11 @@ private string ReplaceGenericSignature(IClassDeclaration? classDeclaration) { if (attribute.GenericTypeAssignment.isPoco) { - genericSignature = genericSignature.Replace(attribute.GenericTypeAssignment.type, $"Pocos.{fieldDeclaresGenericType?.Type.FullyQualifiedName}"); + genericSignature = genericSignature.Replace(attribute.GenericTypeAssignment.type, $"Pocos.{fieldDeclaresGenericType?.Type.FullyQualifiedName}"); } else { - genericSignature = genericSignature.Replace(attribute.GenericTypeAssignment.type, fieldDeclaresGenericType?.Type.FullyQualifiedName); + genericSignature = genericSignature.Replace(attribute.GenericTypeAssignment.type, fieldDeclaresGenericType?.Type.FullyQualifiedName); } } } @@ -103,10 +108,22 @@ public void CreateClassDeclaration(IClassDeclarationSyntax classDeclarationSynta IxNodeVisitor visitor) { TypeCommAccessibility = classDeclaration.GetCommAccessibility(this); - + + // This is a workaround for abstract classes where semantic model does not contain pragmas even when declared in the source. + if (classDeclarationSyntax.ClassKeyword.FullText.Trim().ToLower().StartsWith("{S7.extern=ReadWrite}".ToLower())) + { + TypeCommAccessibility = eCommAccessibility.ReadWrite; + } + + if (classDeclarationSyntax.ClassKeyword.FullText.Trim().ToLower().StartsWith("{S7.extern=Read}".ToLower())) + { + TypeCommAccessibility = eCommAccessibility.ReadOnly; + } + + classDeclarationSyntax.UsingDirectives.ToList().ForEach(p => p.Visit(visitor, this)); var generic = classDeclaration.GetGenericAttributes(); - + AddToSource(classDeclaration.Pragmas.AddAttributes()); AddToSource($"{classDeclaration.AccessModifier.Transform()}partial class {classDeclaration.Name}{generic?.Product}"); AddToSource(":"); @@ -142,7 +159,7 @@ public void CreateClassDeclaration(IClassDeclarationSyntax classDeclarationSynta AddToSource(CsOnlinerPlainerShadowToPlainBuilder.Create(visitor, classDeclaration, this, isExtended).Output); AddToSource(CsOnlinerPlainerShadowToPlainProtectedBuilder.Create(visitor, classDeclaration, this, isExtended).Output); AddToSource(CsOnlinerPlainerPlainToShadowBuilder.Create(visitor, classDeclaration, this, isExtended).Output); - + AddToSource(CsOnlinerHasChangedBuilder.Create(visitor, classDeclaration, this, isExtended).Output); AddPollingMethod(isExtended); @@ -171,7 +188,7 @@ public void CreateConfigDeclaration(IConfigDeclarationSyntax configDeclarationSy IxNodeVisitor visitor) { TypeCommAccessibility = eCommAccessibility.None; - + AddToSource( $"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController : ITwinController {{"); AddToSource($"public {typeof(Connector.Connector).n()} Connector {{ get; }}"); @@ -198,9 +215,9 @@ public void CreateEnumTypeDeclaration(IEnumTypeDeclarationSyntax enumTypeDeclara IxNodeVisitor visitor) { TypeCommAccessibility = eCommAccessibility.None; - + AddToSource($"public enum {enumTypeDeclarationSyntax.Name.Text} {{"); - AddToSource(string.Join("\n,", enumTypeDeclarationSyntax.EnumValues.Select(p => p.Name.Text))); + AddToSource(string.Join("\n,", enumTypeDeclarationSyntax.EnumValueList.EnumValues.Select(p => p.Name.Text))); AddToSource("}"); } @@ -209,9 +226,9 @@ public void CreateNamedValueTypeDeclaration(INamedValueTypeDeclarationSyntax nam INamedValueTypeDeclaration namedValueTypeDeclaration, IxNodeVisitor visitor) { TypeCommAccessibility = eCommAccessibility.None; - + AddToSource( - $"public enum {namedValueTypeDeclarationSyntax.Name.Text} : {namedValueTypeDeclarationSyntax.Type.TransformType()} {{"); + $"public enum {namedValueTypeDeclarationSyntax.Name.Text} : {namedValueTypeDeclarationSyntax.BaseType.TransformType()} {{"); // TODO: Value re-interpretation should be done according to the type. @@ -260,7 +277,7 @@ public void CreateInterfaceDeclaration(IInterfaceDeclarationSyntax interfaceDecl IxNodeVisitor visitor) { TypeCommAccessibility = eCommAccessibility.None; - + AddToSource($"{interfaceDeclaration.AccessModifier.Transform()} partial interface {interfaceDeclaration.Name} {{}}"); } @@ -352,7 +369,7 @@ private void CreateITwinObjectImplementation() "public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; }" + "public System.String GetHumanReadable(System.Globalization.CultureInfo culture) { return this.Translate(_humanReadable, culture); }" + "protected System.String @SymbolTail { get; set;}" + - $"protected {typeof(ITwinObject).n()} @Parent {{ get; set; }}"+ + $"protected {typeof(ITwinObject).n()} @Parent {{ get; set; }}" + $"public AXSharp.Connector.Localizations.Translator Interpreter => global::{Project.TargetProject.ProjectRootNamespace}.PlcTranslator.Instance;" ); } diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs index a44ced5d..3e17b1f5 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs @@ -54,7 +54,18 @@ public void CreateClassDeclaration(IClassDeclarationSyntax classDeclarationSynta IxNodeVisitor visitor) { TypeCommAccessibility = classDeclaration.GetCommAccessibility(this); - + + // This is a workaround for abstract classes where semantic model does not contain pragmas even when declared in the source. + if (classDeclarationSyntax.ClassKeyword.FullText.Trim().ToLower().StartsWith("{S7.extern=ReadWrite}".ToLower())) + { + TypeCommAccessibility = eCommAccessibility.ReadWrite; + } + + if (classDeclarationSyntax.ClassKeyword.FullText.Trim().ToLower().StartsWith("{S7.extern=Read}".ToLower())) + { + TypeCommAccessibility = eCommAccessibility.ReadOnly; + } + classDeclarationSyntax.UsingDirectives.ToList().ForEach(p => p.Visit(visitor, this)); AddToSource($"{classDeclaration.AccessModifier.Transform()}partial class {classDeclaration.Name}"); @@ -64,17 +75,17 @@ public void CreateClassDeclaration(IClassDeclarationSyntax classDeclarationSynta if (isExtended) AddToSource($" : {classDeclaration.ExtendedTypeAccesses.FirstOrDefault()?.Type.FullyQualifiedName}"); - - + + AddToSource(isExtended ? ", AXSharp.Connector.IPlain" : ": AXSharp.Connector.IPlain"); AddToSource(classDeclarationSyntax.ImplementsList != null ? ", " : ""); - + classDeclarationSyntax.ImplementsList?.Visit(visitor, this); - + AddToSource("{"); classDeclarationSyntax.UsingDirectives.ToList().ForEach(p => p.Visit(visitor, this)); @@ -107,7 +118,7 @@ public void CreateFieldDeclaration(IFieldDeclaration fieldDeclaration, IxNodeVis AddToSource("[]"); AddToSource($" {fieldDeclaration.Name}"); AddToSource("{get; set;}"); - + AddToSource($"= new"); arrayType.ElementTypeAccess.Type.Accept(visitor, this); AddToSource($"["); @@ -168,6 +179,13 @@ public virtual void CreateNamedValueTypeDeclaration(INamedValueTypeDeclaration n public void CreateFile(IFileSyntax fileSyntax, IxNodeVisitor visitor) { AddToSource("using System;"); + + foreach (var fileSyntaxUsingDirective in + fileSyntax.UsingDirectives + .Where(p => this.Compilation.GetSemanticTree().Namespaces.Select(p => p.FullyQualifiedName).Contains(p.QualifiedIdentifierList.GetText()))) + { + AddToSource($"using Pocos.{fileSyntaxUsingDirective.QualifiedIdentifierList.GetText()};"); + } AddToSource("namespace Pocos {"); fileSyntax.Declarations.ToList().ForEach(p => p.Visit(visitor, this)); AddToSource("}"); @@ -179,7 +197,7 @@ public void CreateConfigDeclaration(IConfigDeclarationSyntax configDeclarationSy IxNodeVisitor visitor) { TypeCommAccessibility = eCommAccessibility.None; - + AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController{{"); configurationDeclaration.Variables.ToList().ForEach(p => p.Accept(visitor, this)); AddToSource("}"); @@ -280,7 +298,7 @@ public void CreateVariableDeclaration(IVariableDeclaration fieldDeclaration, IxN break; } } - + } /// diff --git a/src/AXSharp.compiler/src/ixc/AXSharp.ixc.csproj b/src/AXSharp.compiler/src/ixc/AXSharp.ixc.csproj index 66935014..80f46ef6 100644 --- a/src/AXSharp.compiler/src/ixc/AXSharp.ixc.csproj +++ b/src/AXSharp.compiler/src/ixc/AXSharp.ixc.csproj @@ -76,7 +76,8 @@ - + + diff --git a/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json b/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json index 15ad3173..fe9bd00f 100644 --- a/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json +++ b/src/AXSharp.compiler/src/ixc/Properties/launchSettings.json @@ -9,7 +9,7 @@ "workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\axopen\\src\\integrations\\ctrl\\" }, "ixc-simple-template": { - "commandName": "Project", + "commandName": "Project", "workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\_axopen\\axopen.templates\\axopen.template.simple\\ax" }, "ixc-template-ref": { @@ -27,6 +27,15 @@ "app-withref-cpm": { "commandName": "Project", "workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\axopen\\src\\templates.simple\\app\\" - } + }, + "axopen-traversal": { + "commandName": "Project", + "workingDirectory": "C:\\W\\Develop\\gh\\ix-ax\\_axopen\\axopen\\src\\traversals\\apax\\" + }, + + "axopen-data": { + "commandName": "Project", + "workingDirectory": "c:\\W\\Develop\\gh\\ix-ax\\_axopen\\axopen\\src\\data\\app\\" + } } } \ No newline at end of file diff --git a/src/AXSharp.compiler/src/ixd/AXSharp.ixd.csproj b/src/AXSharp.compiler/src/ixd/AXSharp.ixd.csproj index 9e64ebab..15cb4747 100644 --- a/src/AXSharp.compiler/src/ixd/AXSharp.ixd.csproj +++ b/src/AXSharp.compiler/src/ixd/AXSharp.ixd.csproj @@ -47,10 +47,11 @@ - - - - + + + + + diff --git a/src/AXSharp.compiler/src/ixd/Program.cs b/src/AXSharp.compiler/src/ixd/Program.cs index 785fa144..fe6ebfc2 100644 --- a/src/AXSharp.compiler/src/ixd/Program.cs +++ b/src/AXSharp.compiler/src/ixd/Program.cs @@ -77,9 +77,9 @@ void GenerateYamls(Options o) var toCompile = projectSources.Select(p => p.parseTree); - var compilation = Compilation.Create(toCompile, Compilation.Settings.Default).Result; + var compilation = Compilation.Create(toCompile, null, Compilation.Settings.Default).Result; - var semanticTree = compilation.GetSemanticTree(); + var semanticTree = compilation.Compilation.GetSemanticTree(); //visit var myNodeVisitor = new MyNodeVisitor(); diff --git a/src/AXSharp.compiler/src/ixd/Visitors/MyNodeVisitor.cs b/src/AXSharp.compiler/src/ixd/Visitors/MyNodeVisitor.cs index 0904cbc5..4917a11e 100644 --- a/src/AXSharp.compiler/src/ixd/Visitors/MyNodeVisitor.cs +++ b/src/AXSharp.compiler/src/ixd/Visitors/MyNodeVisitor.cs @@ -197,7 +197,7 @@ public void Visit(ISemanticTypeAccess semanticTypeAccess, IYamlBuiderVisitor dat public void Visit(IDocComment semanticTypeAccess, IYamlBuiderVisitor data) { - throw new NotImplementedException(); + // throw new NotImplementedException(); } public void Visit(ISemanticInstructionList instrList, IYamlBuiderVisitor data) @@ -205,6 +205,11 @@ public void Visit(ISemanticInstructionList instrList, IYamlBuiderVisitor data) } + public void Visit(ISemanticEmptyInstruction emptyInstruction, IYamlBuiderVisitor data) + { + // throw new NotImplementedException(); + } + public void Visit(ISemanticAssignmentInstruction assignment, IYamlBuiderVisitor data) { @@ -240,11 +245,16 @@ public void Visit(ISemanticCaseStatement caseStatement, IYamlBuiderVisitor data) } - public void Visit(ISemanticCaseSelection caseSelection, IYamlBuiderVisitor data) + public void Visit(ISemanticCaseSelectionStatement caseSelectionStatement, IYamlBuiderVisitor data) { - + throw new NotImplementedException(); } + //public void Visit(ISemanticCaseSelection caseSelection, IYamlBuiderVisitor data) + //{ + + //} + public void Visit(ISemanticSubrange subrange, IYamlBuiderVisitor data) { diff --git a/src/AXSharp.compiler/src/ixr/AXSharp.ixr.csproj b/src/AXSharp.compiler/src/ixr/AXSharp.ixr.csproj index 15547222..938a1376 100644 --- a/src/AXSharp.compiler/src/ixr/AXSharp.ixr.csproj +++ b/src/AXSharp.compiler/src/ixr/AXSharp.ixr.csproj @@ -53,11 +53,12 @@ - - - - - + + + + + + diff --git a/src/AXSharp.compiler/src/ixr/Program.cs b/src/AXSharp.compiler/src/ixr/Program.cs index 6a185c80..a0129977 100644 --- a/src/AXSharp.compiler/src/ixr/Program.cs +++ b/src/AXSharp.compiler/src/ixr/Program.cs @@ -93,33 +93,35 @@ void Generate(Options o) void IterateSyntaxTreeForStringLiterals(ISyntaxNode root, LocalizedStringWrapper lw, string fileName) { - foreach (var literalSyntax in GetChildNodesRecursive(root).OfType()) - { - var token = literalSyntax.Tokens.First(); - //literalSyntax.Location - AddToDictionaryIfLocalizedString(token,lw,fileName); - } + //foreach (var literalSyntax in GetChildNodesRecursive(root).OfType()) + //{ + // var token = literalSyntax.Tokens.First(); + // //literalSyntax.Location + // AddToDictionaryIfLocalizedString(token,lw,fileName); + //} } + + void IterateSyntaxTreeForPragmas(ISyntaxNode root, LocalizedStringWrapper lw, string fileName) { - foreach (var pragmaSyntax in GetChildNodesRecursive(root).OfType()) + foreach (var pragmaSyntax in GetChildNodesRecursive(root).OfType()) { - var token = pragmaSyntax.PragmaToken; - if(lw.IsAttributeNamePragmaToken(token.Text)) - { - AddToDictionaryIfLocalizedString(token,lw,fileName); + var token = pragmaSyntax; + if (lw.IsAttributeNamePragmaToken(token.PragmaContent)) + { + AddToDictionaryIfLocalizedString(token, lw, fileName); } } } -void AddToDictionaryIfLocalizedString(ISyntaxToken token, LocalizedStringWrapper lw, string fileName) +void AddToDictionaryIfLocalizedString(PragmaSyntax token, LocalizedStringWrapper lw, string fileName) { // if is valid token if(IsStringToken(token) || IsPragmaToken(token)) { // try to acquire localized string - var localizedStringList = lw.TryToGetLocalizedStrings(token.Text); + var localizedStringList = lw.TryToGetLocalizedStrings(token.PragmaContent); if(localizedStringList == null) { @@ -137,7 +139,7 @@ void AddToDictionaryIfLocalizedString(ISyntaxToken token, LocalizedStringWrapper //check if identifier is valid if(lw.IsValidId(id)) { - var pos = token.Location.GetLineSpan().StartLinePosition; + var pos = token.SourceText.GetLineSpan(token.Span).StartLinePosition; var wrapper = new StringValueWrapper(rawText, fileName, pos.Line); // add id and wrapper to dictionary lw.LocalizedStringsDictionary.TryAdd(id, wrapper); @@ -145,16 +147,16 @@ void AddToDictionaryIfLocalizedString(ISyntaxToken token, LocalizedStringWrapper } } } -bool IsPragmaToken(ISyntaxToken token) +bool IsPragmaToken(PragmaSyntax token) { - if(token.SyntaxKind == SyntaxKind.PragmaToken) - { - return true; - } + //if(token.SyntaxKind == SyntaxKind.PragmaToken) + //{ + // return true; + //} return false; } -bool IsStringToken(ISyntaxToken token) +bool IsStringToken(PragmaSyntax token) { if(token.SyntaxKind == SyntaxKind.TypedStringDToken || token.SyntaxKind == SyntaxKind.TypedStringSToken || diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj index 51b9e24e..dffc132c 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/AXSharp.Compiler.CsTests.csproj @@ -27,6 +27,7 @@ + @@ -46,6 +47,7 @@ + @@ -59,6 +61,30 @@ + + + PreserveNewest + + + + + + PreserveNewest + + + + + + PreserveNewest + + + + + + PreserveNewest + + + PreserveNewest @@ -97,9 +123,15 @@ PreserveNewest + + PreserveNewest + Always + + Always + @@ -400,7 +432,7 @@ Always - + @@ -428,6 +460,9 @@ ..\..\..\apax\stc\bin\AX.Text.dll + + ..\..\..\apax\stc\bin\AX.ST.Syntax.dll + diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs index 342e3798..05c1583b 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs @@ -273,6 +273,20 @@ public void mixed_access() } + [Fact] + public void abstract_members() + { + var memberName = GetMethodName(); + CompareOutputs(memberName); + } + + + [Fact] + public void generics() + { + CompareOutputs(GetMethodName()); + } + private void CompareOutputs(string memberName) { diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Integration.Cs/IxProjectTests.IntegrationCs.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Integration.Cs/IxProjectTests.IntegrationCs.cs index 32c8a581..0df76e57 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Integration.Cs/IxProjectTests.IntegrationCs.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Integration.Cs/IxProjectTests.IntegrationCs.cs @@ -9,6 +9,7 @@ using AXSharp.Compiler; using AXSharp.Compiler.Cs.Onliner; using AXSharp.Compiler.Cs.Plain; +using Castle.Core.Resource; using Polly; using Xunit.Abstractions; @@ -100,6 +101,8 @@ public void should_match_expected_and_generated_whole_project() if (Directory.Exists(project.OutputFolder)) Directory.Delete(project.OutputFolder, true); + + project.Generate(); var rootSourceFolder = Path.Combine(testFolder, @"samples\units\expected\.g\"); @@ -121,6 +124,7 @@ public void should_match_expected_and_generated_whole_project() var currentIndex = index++; var expectedFileContent = File.ReadAllText(exp); var actualFileContent = File.ReadAllText(actualList[currentIndex]); + try { var actualFileContentLines = actualFileContent.Split("\n").Select(a => a.Trim()).ToArray(); @@ -128,7 +132,7 @@ public void should_match_expected_and_generated_whole_project() for (int i = 0; i < expectedFileContentLines.Length; i++) { - Assert.Equal(expectedFileContentLines[i], actualFileContentLines[i]); + Assert.Equal(expectedFileContentLines[i], actualFileContentLines[i]); } } catch (Exception) diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/abstract_members.g.cs new file mode 100644 index 00000000..dfbac880 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/abstract_members.g.cs @@ -0,0 +1,232 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; + +public partial class AbstractMotor : AXSharp.Connector.ITwinObject +{ + public OnlinerBool Run { get; } + + public OnlinerBool ReverseDirection { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public AbstractMotor(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Run = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Run", "Run"); + ReverseDirection = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "ReverseDirection", "ReverseDirection"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.AbstractMotor plain = new Pocos.AbstractMotor(); + await this.ReadAsync(); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + Pocos.AbstractMotor plain = new Pocos.AbstractMotor(); + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(Pocos.AbstractMotor plain) + { + plain.Run = Run.LastValue; + plain.ReverseDirection = ReverseDirection.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.AbstractMotor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(Pocos.AbstractMotor plain) + { +#pragma warning disable CS0612 + Run.LethargicWrite(plain.Run); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + ReverseDirection.LethargicWrite(plain.ReverseDirection); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + Pocos.AbstractMotor plain = new Pocos.AbstractMotor(); + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(Pocos.AbstractMotor plain) + { + plain.Run = Run.Shadow; + plain.ReverseDirection = ReverseDirection.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(Pocos.AbstractMotor plain) + { + Run.Shadow = plain.Run; + ReverseDirection.Shadow = plain.ReverseDirection; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(Pocos.AbstractMotor plain, Pocos.AbstractMotor latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Run != Run.LastValue) + somethingChanged = true; + if (plain.ReverseDirection != ReverseDirection.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.AbstractMotor CreateEmptyPoco() + { + return new Pocos.AbstractMotor(); + } + + private IList Children { get; } = new List(); + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/file_with_usings.g.cs index 277eab90..7960acb2 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/file_with_usings.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/file_with_usings.g.cs @@ -9,15 +9,787 @@ namespace FileWithUsingsSimpleFirstLevelNamespace { + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + await this.ReadAsync(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain = new Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello plain, Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello CreateEmptyPoco() + { + return new Pocos.FileWithUsingsSimpleFirstLevelNamespace.Hello(); + } + + private IList Children { get; } = new List(); + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } } namespace FileWithUsingsSimpleQualifiedNamespace.Qualified { + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + await this.ReadAsync(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain = new Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello plain, Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello CreateEmptyPoco() + { + return new Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello(); + } + + private IList Children { get; } = new List(); + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } } namespace FileWithUsingsHelloLevelOne { namespace FileWithUsingsHelloLevelTwo { + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + await this.ReadAsync(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain = new Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello plain, Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello CreateEmptyPoco() + { + return new Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello(); + } + + private IList Children { get; } = new List(); + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + } +} + +namespace ExampleNamespace +{ + public partial class Hello : AXSharp.Connector.ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Hello(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.ExampleNamespace.Hello plain = new Pocos.ExampleNamespace.Hello(); + await this.ReadAsync(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + Pocos.ExampleNamespace.Hello plain = new Pocos.ExampleNamespace.Hello(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(Pocos.ExampleNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.ExampleNamespace.Hello plain) + { + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(Pocos.ExampleNamespace.Hello plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + Pocos.ExampleNamespace.Hello plain = new Pocos.ExampleNamespace.Hello(); + return plain; + } + + protected async Task ShadowToPlainAsync(Pocos.ExampleNamespace.Hello plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(Pocos.ExampleNamespace.Hello plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(Pocos.ExampleNamespace.Hello plain, Pocos.ExampleNamespace.Hello latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.ExampleNamespace.Hello CreateEmptyPoco() + { + return new Pocos.ExampleNamespace.Hello(); + } + + private IList Children { get; } = new List(); + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; } } \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/generics.g.cs new file mode 100644 index 00000000..0aab9689 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/generics.g.cs @@ -0,0 +1,583 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; + +namespace GenericsTests +{ + public partial class Extender : AXSharp.Connector.ITwinObject where TOnline : ITwinObject + { + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extender(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.GenericsTests.Extender plain = new Pocos.GenericsTests.Extender(); + await this.ReadAsync(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + Pocos.GenericsTests.Extender plain = new Pocos.GenericsTests.Extender(); + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(Pocos.GenericsTests.Extender plain) + { + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.GenericsTests.Extender plain) + { + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(Pocos.GenericsTests.Extender plain) + { + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + Pocos.GenericsTests.Extender plain = new Pocos.GenericsTests.Extender(); + return plain; + } + + protected async Task ShadowToPlainAsync(Pocos.GenericsTests.Extender plain) + { + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(Pocos.GenericsTests.Extender plain) + { + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(Pocos.GenericsTests.Extender plain, Pocos.GenericsTests.Extender latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.GenericsTests.Extender CreateEmptyPoco() + { + return new Pocos.GenericsTests.Extender(); + } + + private IList Children { get; } = new List(); + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class SomeTypeToBeGeneric : AXSharp.Connector.ITwinObject + { + public OnlinerBool Boolean { get; } + + public OnlinerInt Cele { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public SomeTypeToBeGeneric(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + this.@SymbolTail = symbolTail; + this.@Connector = parent.GetConnector(); + this.@Parent = parent; + HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail); + PreConstruct(parent, readableTail, symbolTail); + Boolean = @Connector.ConnectorAdapter.AdapterFactory.CreateBOOL(this, "Boolean", "Boolean"); + Cele = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "Cele", "Cele"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public async Task OnlineToPlainAsync() + { + Pocos.GenericsTests.SomeTypeToBeGeneric plain = new Pocos.GenericsTests.SomeTypeToBeGeneric(); + await this.ReadAsync(); + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _OnlineToPlainNoacAsync() + { + Pocos.GenericsTests.SomeTypeToBeGeneric plain = new Pocos.GenericsTests.SomeTypeToBeGeneric(); + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + plain.Boolean = Boolean.LastValue; + plain.Cele = Cele.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { +#pragma warning disable CS0612 + Boolean.LethargicWrite(plain.Boolean); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Cele.LethargicWrite(plain.Cele); +#pragma warning restore CS0612 + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { +#pragma warning disable CS0612 + Boolean.LethargicWrite(plain.Boolean); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + Cele.LethargicWrite(plain.Cele); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + Pocos.GenericsTests.SomeTypeToBeGeneric plain = new Pocos.GenericsTests.SomeTypeToBeGeneric(); + plain.Boolean = Boolean.Shadow; + plain.Cele = Cele.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + plain.Boolean = Boolean.Shadow; + plain.Cele = Cele.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(Pocos.GenericsTests.SomeTypeToBeGeneric plain) + { + Boolean.Shadow = plain.Boolean; + Cele.Shadow = plain.Cele; + return this.RetrievePrimitives(); + } + + /// + public async virtual Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public async Task DetectsAnyChangeAsync(Pocos.GenericsTests.SomeTypeToBeGeneric plain, Pocos.GenericsTests.SomeTypeToBeGeneric latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.Boolean != Boolean.LastValue) + somethingChanged = true; + if (plain.Cele != Cele.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public Pocos.GenericsTests.SomeTypeToBeGeneric CreateEmptyPoco() + { + return new Pocos.GenericsTests.SomeTypeToBeGeneric(); + } + + private IList Children { get; } = new List(); + public IEnumerable GetChildren() + { + return Children; + } + + private IList Kids { get; } = new List(); + public IEnumerable GetKids() + { + return Kids; + } + + private IList ValueTags { get; } = new List(); + public IEnumerable GetValueTags() + { + return ValueTags; + } + + public void AddValueTag(AXSharp.Connector.ITwinPrimitive valueTag) + { + ValueTags.Add(valueTag); + } + + public void AddKid(AXSharp.Connector.ITwinElement kid) + { + Kids.Add(kid); + } + + public void AddChild(AXSharp.Connector.ITwinObject twinObject) + { + Children.Add(twinObject); + } + + protected AXSharp.Connector.Connector @Connector { get; } + + public AXSharp.Connector.Connector GetConnector() + { + return this.@Connector; + } + + public string GetSymbolTail() + { + return this.SymbolTail; + } + + public AXSharp.Connector.ITwinObject GetParent() + { + return this.@Parent; + } + + public string Symbol { get; protected set; } + + private string _attributeName; + public System.String AttributeName { get => string.IsNullOrEmpty(_attributeName) ? SymbolTail : _attributeName.Interpolate(this).CleanUpLocalizationTokens(); set => _attributeName = value; } + + public System.String GetAttributeName(System.Globalization.CultureInfo culture) + { + return this.Translate(_attributeName, culture).Interpolate(this); + } + + private string _humanReadable; + public string HumanReadable { get => string.IsNullOrEmpty(_humanReadable) ? SymbolTail : _humanReadable.Interpolate(this).CleanUpLocalizationTokens(); set => _humanReadable = value; } + + public System.String GetHumanReadable(System.Globalization.CultureInfo culture) + { + return this.Translate(_humanReadable, culture); + } + + protected System.String @SymbolTail { get; set; } + + protected AXSharp.Connector.ITwinObject @Parent { get; set; } + + public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance; + } + + public partial class Extendee2 : GenericsTests.Extender + { + [AXOpen.Data.AxoDataEntityAttribute] + [Container(Layout.Stack)] + public GenericsTests.SomeTypeToBeGeneric SomeData { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public Extendee2(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail) : base(parent, readableTail, symbolTail) + { + Symbol = AXSharp.Connector.Connector.CreateSymbol(parent.Symbol, symbolTail); + PreConstruct(parent, readableTail, symbolTail); + SomeData = new GenericsTests.SomeTypeToBeGeneric(this, "Shared Header", "SomeData"); + SomeData.AttributeName = "Shared Header"; + PostConstruct(parent, readableTail, symbolTail); + } + + public async override Task OnlineToPlain() + { + return await (dynamic)this.OnlineToPlainAsync(); + } + + public new async Task OnlineToPlainAsync() + { + Pocos.GenericsTests.Extendee2 plain = new Pocos.GenericsTests.Extendee2(); + await this.ReadAsync(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public new async Task _OnlineToPlainNoacAsync() + { + Pocos.GenericsTests.Extendee2 plain = new Pocos.GenericsTests.Extendee2(); +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + protected async Task _OnlineToPlainNoacAsync(Pocos.GenericsTests.Extendee2 plain) + { +#pragma warning disable CS0612 + await base._OnlineToPlainNoacAsync(plain); +#pragma warning restore CS0612 +#pragma warning disable CS0612 + plain.SomeData = await SomeData._OnlineToPlainNoacAsync(); +#pragma warning restore CS0612 + return plain; + } + + public async override Task PlainToOnline(T plain) + { + await this.PlainToOnlineAsync((dynamic)plain); + } + + public async Task> PlainToOnlineAsync(Pocos.GenericsTests.Extendee2 plain) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); +#pragma warning restore CS0612 + return await this.WriteAsync(); + } + + [Obsolete("This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead.")] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public async Task _PlainToOnlineNoacAsync(Pocos.GenericsTests.Extendee2 plain) + { + await base._PlainToOnlineNoacAsync(plain); +#pragma warning disable CS0612 + await this.SomeData._PlainToOnlineNoacAsync(plain.SomeData); +#pragma warning restore CS0612 + } + + public async override Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public new async Task ShadowToPlainAsync() + { + Pocos.GenericsTests.Extendee2 plain = new Pocos.GenericsTests.Extendee2(); + await base.ShadowToPlainAsync(plain); + plain.SomeData = await SomeData.ShadowToPlainAsync(); + return plain; + } + + protected async Task ShadowToPlainAsync(Pocos.GenericsTests.Extendee2 plain) + { + await base.ShadowToPlainAsync(plain); + plain.SomeData = await SomeData.ShadowToPlainAsync(); + return plain; + } + + public async override Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(Pocos.GenericsTests.Extendee2 plain) + { + await base.PlainToShadowAsync(plain); + await this.SomeData.PlainToShadowAsync(plain.SomeData); + return this.RetrievePrimitives(); + } + + /// + public async override Task AnyChangeAsync(T plain) + { + return await this.DetectsAnyChangeAsync((dynamic)plain); + } + + /// + ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated. + ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed. + /// + public new async Task DetectsAnyChangeAsync(Pocos.GenericsTests.Extendee2 plain, Pocos.GenericsTests.Extendee2 latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (await base.DetectsAnyChangeAsync(plain)) + return true; + if (await SomeData.DetectsAnyChangeAsync(plain.SomeData, latest.SomeData)) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public new void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public new Pocos.GenericsTests.Extendee2 CreateEmptyPoco() + { + return new Pocos.GenericsTests.Extendee2(); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/abstract_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/abstract_members.g.cs new file mode 100644 index 00000000..d11d4a1f --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/abstract_members.g.cs @@ -0,0 +1,11 @@ +using System; + +namespace Pocos +{ + public partial class AbstractMotor : AXSharp.Connector.IPlain + { + public Boolean Run { get; set; } + + public Boolean ReverseDirection { get; set; } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/file_with_usings.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/file_with_usings.g.cs index e9de1bf9..0d64ca0c 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/file_with_usings.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/file_with_usings.g.cs @@ -1,22 +1,37 @@ using System; +using Pocos.FileWithUsingsSimpleFirstLevelNamespace; +using Pocos.FileWithUsingsSimpleQualifiedNamespace.Qualified; +using Pocos.FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; namespace Pocos { - using FileWithUsingsSimpleFirstLevelNamespace; - using FileWithUsingsSimpleQualifiedNamespace.Qualified; - using FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; - namespace FileWithUsingsSimpleFirstLevelNamespace { + public partial class Hello : AXSharp.Connector.IPlain + { + } } namespace FileWithUsingsSimpleQualifiedNamespace.Qualified { + public partial class Hello : AXSharp.Connector.IPlain + { + } } namespace FileWithUsingsHelloLevelOne { namespace FileWithUsingsHelloLevelTwo + { + public partial class Hello : AXSharp.Connector.IPlain + { + } + } + } + + namespace ExampleNamespace + { + public partial class Hello : AXSharp.Connector.IPlain { } } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/generics.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/generics.g.cs new file mode 100644 index 00000000..cace0f96 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/generics.g.cs @@ -0,0 +1,23 @@ +using System; + +namespace Pocos +{ + namespace GenericsTests + { + public partial class Extender : AXSharp.Connector.IPlain + { + } + + public partial class SomeTypeToBeGeneric : AXSharp.Connector.IPlain + { + public Boolean Boolean { get; set; } + + public Int16 Cele { get; set; } + } + + public partial class Extendee2 : GenericsTests.Extender, AXSharp.Connector.IPlain + { + public GenericsTests.SomeTypeToBeGeneric SomeData { get; set; } = new GenericsTests.SomeTypeToBeGeneric(); + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/abstract_members.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/abstract_members.st new file mode 100644 index 00000000..d2a91b2d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/abstract_members.st @@ -0,0 +1,8 @@ +{S7.extern=ReadWrite} +CLASS ABSTRACT AbstractMotor + VAR PUBLIC + Run : BOOL; + ReverseDirection : BOOL; + END_VAR + ... +END_CLASS \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/file_with_usings.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/file_with_usings.st index 84ea3b93..1d335b17 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/file_with_usings.st +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/file_with_usings.st @@ -3,14 +3,37 @@ USING FileWithUsingsSimpleQualifiedNamespace.Qualified; USING FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo; NAMESPACE FileWithUsingsSimpleFirstLevelNamespace - + CLASS Hello + VAR + + END_VAR + END_CLASS END_NAMESPACE NAMESPACE FileWithUsingsSimpleQualifiedNamespace.Qualified - + CLASS Hello + VAR + + END_VAR + END_CLASS END_NAMESPACE NAMESPACE FileWithUsingsHelloLevelOne NAMESPACE FileWithUsingsHelloLevelTwo + CLASS Hello + VAR + + END_VAR + END_CLASS END_NAMESPACE -END_NAMESPACE \ No newline at end of file +END_NAMESPACE + +NAMESPACE ExampleNamespace + CLASS Hello + VAR + a : FileWithUsingsSimpleFirstLevelNamespace.Hello; + b : FileWithUsingsSimpleQualifiedNamespace.Qualified.Hello; + c : FileWithUsingsHelloLevelOne.FileWithUsingsHelloLevelTwo.Hello; + END_VAR + END_CLASS +END_NAMESPACE \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/generics.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/generics.st new file mode 100644 index 00000000..24aae06d --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/generics.st @@ -0,0 +1,28 @@ +// GENERIC +NAMESPACE GenericsTests + {#ix-generic: where TOnline : ITwinObject} + {S7.extern=ReadWrite} + CLASS PUBLIC Extender + + END_CLASS + + {S7.extern=ReadWrite} + CLASS PUBLIC SomeTypeToBeGeneric + VAR PUBLIC + Boolean : BOOL; + Cele : INT; + END_VAR + END_CLASS + + {S7.extern=ReadWrite} + CLASS PUBLIC Extendee2 EXTENDS Extender + VAR PUBLIC + {#ix-generic:TOnline} + {#ix-generic:TPlain as POCO} + {#ix-attr:[AXOpen.Data.AxoDataEntityAttribute]} + {#ix-attr:[Container(Layout.Stack)]} + {#ix-set:AttributeName = "Shared Header"} + SomeData : SomeTypeToBeGeneric; + END_VAR + END_CLASS +END_NAMESPACE \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/AXSharp.CompilerTests.csproj b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/AXSharp.CompilerTests.csproj index 3769ac00..d37b8cb0 100644 --- a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/AXSharp.CompilerTests.csproj +++ b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/AXSharp.CompilerTests.csproj @@ -84,5 +84,8 @@ ..\..\..\apax\stc\bin\AX.Text.dll + + ..\..\..\apax\stc\bin\AX.ST.Compiler.PluginAbstractions.dll + \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTests.cs b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTests.cs index 3e7fcc44..95ae0cf3 100644 --- a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTests.cs +++ b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTests.cs @@ -43,7 +43,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithPartia var data = new Mock().Object; // Act - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(partialSemanticTree, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(partialSemanticTree, data)); // Assert @@ -52,13 +52,13 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithPartia [Fact] public void CannotCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithPartialSemanticTreeAndDataWithNullPartialSemanticTree() { - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(default(IPartialSemanticTree), new Mock().Object)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(default(IPartialSemanticTree), new Mock().Object)); } [Fact] public void CannotCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithPartialSemanticTreeAndDataWithNullData() { - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(new Mock().Object, default(ICombinedThreeVisitor))); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(new Mock().Object, default(ICombinedThreeVisitor))); } [Fact] @@ -69,7 +69,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithSymbol var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(symbol, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(symbol, data)); } @@ -113,7 +113,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithTaskCo var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(taskConfigurationDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(taskConfigurationDeclaration, data)); @@ -128,7 +128,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithTaskDe var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(taskDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(taskDeclaration, data)); } @@ -140,7 +140,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithProgra var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(programConfigurationDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(programConfigurationDeclaration, data)); @@ -154,7 +154,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithNamesp var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(namespaceDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(namespaceDeclaration, data)); @@ -170,7 +170,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithUsingD var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(usingDirective, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(usingDirective, data)); @@ -184,7 +184,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithProgra var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(programDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(programDeclaration, data)); @@ -231,7 +231,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithFuncti var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(functionDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(functionDeclaration, data)); @@ -246,7 +246,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithFuncti var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(functionBlockDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(functionBlockDeclaration, data)); @@ -260,7 +260,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithMethod var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(methodDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(methodDeclaration, data)); @@ -275,7 +275,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithMethod var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(methodPrototypeDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(methodPrototypeDeclaration, data)); @@ -409,7 +409,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithDimens var data = new Mock().Object; // Act - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(dimension, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(dimension, data)); // Assert @@ -459,7 +459,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithEnumVa var data = new Mock().Object; // Act - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(enumValueDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(enumValueDeclaration, data)); // Assert @@ -474,7 +474,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithNamedV var data = new Mock().Object; // Act - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(namedValueDeclaration, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(namedValueDeclaration, data)); // Assert @@ -489,7 +489,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithInitia var data = new Mock().Object; // Act - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(initializerExpression, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(initializerExpression, data)); // Assert @@ -505,7 +505,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithArrayI var data = new Mock().Object; // Act - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(arrayInitializer, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(arrayInitializer, data)); // Assert @@ -520,7 +520,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithStruct var data = new Mock().Object; // Act - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(structureInitializer, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(structureInitializer, data)); // Assert @@ -535,7 +535,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithMember var data = new Mock().Object; // Act - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(memberInitializer, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(memberInitializer, data)); // Assert @@ -568,7 +568,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithInstrL var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(instrList, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(instrList, data)); @@ -584,7 +584,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithISeman var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(assignment, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(assignment, data)); @@ -600,7 +600,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithISeman var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(assignment, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(assignment, data)); @@ -615,7 +615,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithAssign var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(assignmentAttempt, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(assignmentAttempt, data)); @@ -630,7 +630,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithExpres var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(expression, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(expression, data)); @@ -645,7 +645,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithCondSt var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(condStatement, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(condStatement, data)); @@ -661,7 +661,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithCondIn var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(condInstrList, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(condInstrList, data)); @@ -677,7 +677,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithCaseSt var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(caseStatement, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(caseStatement, data)); @@ -685,19 +685,19 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithCaseSt - [Fact] - public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithCaseSelectionAndData() - { - // Arrange - var caseSelection = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithCaseSelectionAndData() + //{ + // // Arrange + // var caseSelection = new Mock().Object; + // var data = new Mock().Object; - // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(caseSelection, data)); + // // Assert + // Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(caseSelection, data)); - } + //} @@ -709,7 +709,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithSubran var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(subrange, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(subrange, data)); @@ -725,7 +725,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithForSta var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(forStatement, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(forStatement, data)); @@ -741,7 +741,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithWhileS var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(whileStatement, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(whileStatement, data)); @@ -757,7 +757,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithRepeat var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(repeatStatement, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(repeatStatement, data)); @@ -773,7 +773,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithContin var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(continueInstruction, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(continueInstruction, data)); @@ -789,7 +789,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithExitIn var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(exitInstruction, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(exitInstruction, data)); @@ -805,7 +805,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithReturn var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(returnStatement, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(returnStatement, data)); @@ -821,7 +821,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithAsmSta var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(asmStatement, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(asmStatement, data)); @@ -836,7 +836,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithConstE var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(constExpr, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(constExpr, data)); @@ -851,7 +851,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithIdenti var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(identifierAccess, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(identifierAccess, data)); @@ -867,7 +867,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithBinExp var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(binExpr, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(binExpr, data)); @@ -883,7 +883,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithUnaryE var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(unaryExpression, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(unaryExpression, data)); @@ -899,7 +899,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithQualif var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(qualifiedEnumAccess, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(qualifiedEnumAccess, data)); @@ -915,7 +915,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithMember var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(memberAccessExpression, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(memberAccessExpression, data)); @@ -932,7 +932,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithArrayA // Assert - Assert.Throws( + Assert.Throws( () => ((ISemanticNodeVisitor)_testClass).Visit(arrayAccessExpression, data)); } @@ -947,7 +947,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithCallAn var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(call, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(call, data)); @@ -963,7 +963,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithParamL var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(paramList, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(paramList, data)); } @@ -978,7 +978,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithParamA var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(paramAssignment, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(paramAssignment, data)); @@ -994,7 +994,7 @@ public void CanCallVisitForISemanticNodeVisitor_ICombinedThreeVisitor_WithPartia var data = new Mock().Object; // Assert - Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(partialAccessExpression, data)); + Assert.Throws(() => ((ISemanticNodeVisitor)_testClass).Visit(partialAccessExpression, data)); diff --git a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs index c3377cb6..f08c0fc6 100644 --- a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs +++ b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/Core/IxNodeVisitorTestsSemantics.cs @@ -6,6 +6,7 @@ // Third party licenses: https://github.com/ix-ax/axsharp/blob/master/notices.md using AX.ST.Semantic; +using AX.ST.Semantic.Analyzer; using AX.Text; using AXSharp.Compiler.Core; @@ -45,7 +46,12 @@ public IxNodeVisitorTestsSemantics() new StringText("TYPE\r\n TestStructureType : STRUCT\r\n isRunning : BOOL;\r\n END_STRUCT; END_TYPE") }; - _compilation = Compilation.Create(sources.Select(s => STParser.ParseTextAsync(s).Result), Compilation.Settings.Default).Result; + //_compilation = Compilation.Create(sources.Select(s => STParser.ParseTextAsync(s).Result), Compilation.Settings.Default).Result; + var analizers = new List(); + _compilation = Compilation.Create(sources.Select(s => STParser.ParseTextAsync(s).Result), analizers).Result.Compilation; + + + _testClass = new IxNodeVisitor(_compilation); } @@ -525,19 +531,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithUserDec - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithPragmaSyntaxAndData() - { - // Arrange - var pragmaSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithPragmaSyntaxAndData() + //{ + // // Arrange + // var pragmaSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(pragmaSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(pragmaSyntax, data)); - // Assert + // // Assert - } + //} @@ -605,19 +611,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithTaskDec - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithTaskConfigSyntaxAndData() - { - // Arrange - var taskConfigSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithTaskConfigSyntaxAndData() + //{ + // // Arrange + // var taskConfigSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(taskConfigSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(taskConfigSyntax, data)); - // Assert + // // Assert - } + //} @@ -637,19 +643,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithProgCon - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithAbstractMethodDeclarationSyntaxAndData() - { - // Arrange - var abstractMethodDeclarationSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithAbstractMethodDeclarationSyntaxAndData() + //{ + // // Arrange + // var abstractMethodDeclarationSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(abstractMethodDeclarationSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(abstractMethodDeclarationSyntax, data)); - // Assert - // - } + // // Assert + // // + //} @@ -748,19 +754,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithAnonymo - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithArgumentExpressionSyntaxAndData() - { - // Arrange - var argumentExpressionSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithArgumentExpressionSyntaxAndData() + //{ + // // Arrange + // var argumentExpressionSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(argumentExpressionSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(argumentExpressionSyntax, data)); - // Assert + // // Assert - } + //} @@ -1003,67 +1009,67 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCallExp - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCallParamAssignmentLhsSyntaxAndData() - { - // Arrange - var callParamAssignmentLhsSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCallParamAssignmentLhsSyntaxAndData() + //{ + // // Arrange + // var callParamAssignmentLhsSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(callParamAssignmentLhsSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(callParamAssignmentLhsSyntax, data)); - // Assert + // // Assert - } + //} - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCaseListElemSyntaxAndData() - { - // Arrange - var caseListElemSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCaseListElemSyntaxAndData() + //{ + // // Arrange + // var caseListElemSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(caseListElemSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(caseListElemSyntax, data)); - // Assert + // // Assert - } + //} - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCaseListSyntaxAndData() - { - // Arrange - var caseListSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCaseListSyntaxAndData() + //{ + // // Arrange + // var caseListSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(caseListSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(caseListSyntax, data)); - // Assert + // // Assert - } + //} - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCaseSelectionSyntaxAndData() - { - // Arrange - var caseSelectionSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCaseSelectionSyntaxAndData() + //{ + // // Arrange + // var caseSelectionSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(caseSelectionSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(caseSelectionSyntax, data)); - // Assert + // // Assert - } + //} @@ -1116,19 +1122,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCodeBod - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCommaCaseListElemSyntaxAndData() - { - // Arrange - var commaCaseListElemSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithCommaCaseListElemSyntaxAndData() + //{ + // // Arrange + // var commaCaseListElemSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(commaCaseListElemSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(commaCaseListElemSyntax, data)); - // Assert + // // Assert - } + //} @@ -1356,19 +1362,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithExpress - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithExternFunctionDeclarationSyntaxAndData() - { - // Arrange - var externFunctionDeclarationSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithExternFunctionDeclarationSyntaxAndData() + //{ + // // Arrange + // var externFunctionDeclarationSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(externFunctionDeclarationSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(externFunctionDeclarationSyntax, data)); - // Assert + // // Assert - } + //} @@ -1595,19 +1601,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithMultipl - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithNamedParamListSyntaxAndData() - { - // Arrange - var namedParamListSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithNamedParamListSyntaxAndData() + //{ + // // Arrange + // var namedParamListSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(namedParamListSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(namedParamListSyntax, data)); - // Assert + // // Assert - } + //} @@ -1837,19 +1843,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithProgram - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithQualifiedEnumAccessSyntaxAndData() - { - // Arrange - var qualifiedEnumAccessSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithQualifiedEnumAccessSyntaxAndData() + //{ + // // Arrange + // var qualifiedEnumAccessSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(qualifiedEnumAccessSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(qualifiedEnumAccessSyntax, data)); - // Assert + // // Assert - } + //} @@ -2029,19 +2035,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithStateme - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithStatementPartSyntaxAndData() - { - // Arrange - var statementPartSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithStatementPartSyntaxAndData() + //{ + // // Arrange + // var statementPartSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(statementPartSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(statementPartSyntax, data)); - // Assert + // // Assert - } + //} @@ -2205,19 +2211,19 @@ public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithTypeSyn - [Fact] - public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithUnnamedParamListSyntaxAndData() - { - // Arrange - var unnamedParamListSyntax = new Mock().Object; - var data = new Mock().Object; + //[Fact] + //public void CanCallAcceptForISyntaxNodeVisitor_ICombinedThreeVisitor_WithUnnamedParamListSyntaxAndData() + //{ + // // Arrange + // var unnamedParamListSyntax = new Mock().Object; + // var data = new Mock().Object; - // Act - Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(unnamedParamListSyntax, data)); + // // Act + // Assert.Throws(() => ((ISyntaxNodeVisitor)_testClass).Accept(unnamedParamListSyntax, data)); - // Assert + // // Assert - } + //} diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 66e95282..8b5f8fa5 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -9,15 +9,17 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + - + + diff --git a/src/apax/apax-lock.json b/src/apax/apax-lock.json index daddd372..2a89dda9 100644 --- a/src/apax/apax-lock.json +++ b/src/apax/apax-lock.json @@ -7,25 +7,25 @@ "name": "s", "version": "0.0.0", "devDependencies": { - "@ax/stc": "5.3.28" + "@ax/stc": "6.1.59" } }, "packages": { "@ax/stc": { "name": "@ax/stc", - "version": "5.3.28", - "integrity": "sha512-1YYnkgUIjlPLVkBntVPeOCd+IQ4rj+TUa6DGjj9mqdKlQDqMsqX2sDvS+IOtu3TGskB38GE40PEsvS1B5lQS5w==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc/-/stc-5.3.28.tgz", + "version": "6.1.59", + "integrity": "sha512-9fSnPIR1Le1i5vA0g13ONfvwWXY6MOM/5+8cDeFvWRh0iIZwviYjCXJ5XM5kv7/wKdkJHZTelQWF6GMPnvWORw==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc/-/stc-6.1.59.tgz", "dependencies": { - "@ax/stc-win-x64": "5.3.28", - "@ax/stc-linux-x64": "5.3.28" + "@ax/stc-win-x64": "6.1.59", + "@ax/stc-linux-x64": "6.1.59" } }, "@ax/stc-win-x64": { "name": "@ax/stc-win-x64", - "version": "5.3.28", - "integrity": "sha512-WzeBs2ELhfwo6E0S+tjL+wljfd5ndqAAeSf8xUQIscCLZyZV4aqFyBAHg34qlqiqu6+go3fFG2UGGKiMQQ8hqQ==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-win-x64/-/stc-win-x64-5.3.28.tgz", + "version": "6.1.59", + "integrity": "sha512-PMI1NqqJlANZyug6ZFsXBP0SFneGKo0nAeUtO7KiKC4LAdmLZ54gOvc6OzxUUhuSrjI1yD1zO9faQP7s/Hu15g==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-win-x64/-/stc-win-x64-6.1.59.tgz", "os": [ "win32" ], @@ -33,14 +33,14 @@ "x64" ], "dependencies": { - "@ax/st-docs": "5.3.28" + "@ax/st-docs": "6.1.59" } }, "@ax/stc-linux-x64": { "name": "@ax/stc-linux-x64", - "version": "5.3.28", - "integrity": "sha512-IQncNWsUogtm7uIS+j5HGZNZAWZ9iChSvoHB/irOmbBDVW7ZWYmIn8gpAAWXQiaDQLB5EzXuGxnASkdQFGDg3g==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-linux-x64/-/stc-linux-x64-5.3.28.tgz", + "version": "6.1.59", + "integrity": "sha512-cggJ3PcIu683s6kTLy0U2bFVOGPvVLjGmWQVp2XB1yC33bZY/HJK28pjJaNUvSOk9AVwgEpDWT15nF99kjN05g==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-linux-x64/-/stc-linux-x64-6.1.59.tgz", "os": [ "linux" ], @@ -48,14 +48,14 @@ "x64" ], "dependencies": { - "@ax/st-docs": "5.3.28" + "@ax/st-docs": "6.1.59" } }, "@ax/st-docs": { "name": "@ax/st-docs", - "version": "5.3.28", - "integrity": "sha512-HPaafcaiujBjUWDzWKVKAB/k0f2QOr2O38pCBdnFdTEzjUS/A6wfeji4Zb+LEaXfbxmYpB2G1+9eau9bFcCBlA==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-5.3.28.tgz", + "version": "6.1.59", + "integrity": "sha512-yKvjrpe7o6MQYeAHNxkSGtHXWn7sMDSLt0HzqxFSNGiw3OFQwYADSRTEpgi7TETA1u4pBbNTOCie4TDtYyYhiw==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-6.1.59.tgz", "dependencies": {} } }, diff --git a/src/apax/apax.yml b/src/apax/apax.yml index fa5557ce..c66baaa1 100644 --- a/src/apax/apax.yml +++ b/src/apax/apax.yml @@ -5,6 +5,6 @@ targets: - "1500" - axunit-llvm devDependencies: - "@ax/stc": 5.3.28 + "@ax/stc": 6.1.59 installStrategy: strict -apaxVersion: 3.1.0 +apaxVersion: 3.1.1 diff --git a/src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs b/src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs index 6065134e..8496ba66 100644 --- a/src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs +++ b/src/sanbox/integration/ix-integration-plc/ix/.g/POCO/configuration.g.cs @@ -1,9 +1,8 @@ using System; +using Pocos.MonsterData; namespace Pocos { - using MonsterData; - public partial class ix_integration_plcTwinController { public all_primitives all_primitives { get; set; } = new all_primitives(); diff --git a/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs b/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs index 3b41e0e6..cdea574d 100644 --- a/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs +++ b/src/tests.integrations/integrated/src/integrated.twin/.g/POCO/configuration.g.cs @@ -1,9 +1,8 @@ using System; +using Pocos.RealMonsterData; namespace Pocos { - using RealMonsterData; - public partial class integratedTwinController { public MonsterData.Monster Monster { get; set; } = new MonsterData.Monster(); diff --git a/templates/working/templates/axsharpblazor/axsharpblazor.twin/axsharpblazor.csproj b/templates/working/templates/axsharpblazor/axsharpblazor.twin/axsharpblazor.csproj new file mode 100644 index 00000000..6e9cb742 --- /dev/null +++ b/templates/working/templates/axsharpblazor/axsharpblazor.twin/axsharpblazor.csproj @@ -0,0 +1,21 @@ + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + \ No newline at end of file