From 6167a9a0f6e23cc3a1bbe0a4cccfd924a7e76b73 Mon Sep 17 00:00:00 2001
From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com>
Date: Tue, 7 May 2024 08:18:38 +0200
Subject: [PATCH] Updates ixc to use stc v6 (#309)
* The most significant changes involve the addition of a foreach loop in the `CsOnlinerSourceBuilder` and `CsPlainSourceBuilder` classes, which iterates over the `UsingDirectives` of the `fileSyntax` object and adds each `UsingDirective` to the source code with the appropriate namespace. Additionally, the `class_extended_by_known_type.g.cs` and `file_with_usings.g.cs` files have been updated to include more `using` directives, importing namespaces related to `Simatic.Ax.Stateframework`, `Simatic.Ax.StatePattern`, and various `FileWithUsings` namespaces.
1. The `CsOnlinerSourceBuilder` and `CsPlainSourceBuilder` classes have been updated to include a foreach loop that iterates over the `UsingDirectives` of the `fileSyntax` object. This loop adds each `UsingDirective` to the source code with the appropriate namespace. The `CsOnlinerSourceBuilder` adds the namespace as is, while the `CsPlainSourceBuilder` prepends "Pocos." to the namespace.
2. The `class_extended_by_known_type.g.cs` and `file_with_usings.g.cs` files have been updated to include additional `using` directives. These directives import namespaces related to the `Simatic.Ax.Stateframework`, `Simatic.Ax.StatePattern`, and various `FileWithUsings` namespaces.
3. The `class_extended_by_known_type.g.cs` and `file_with_usings.g.cs` files have also been updated to include additional `using` directives under the `Pocos` namespace. These directives import the same namespaces as above, but under the `Pocos` namespace.
* The most significant changes involve the modification of several methods to change the parameter type from `ISyntaxToken` to `PragmaSyntax`. This includes the `AddToDictionaryIfLocalizedString`, `IsPragmaToken`, and `IsStringToken` methods. Additionally, the `IterateSyntaxTreeForPragmas` method has been uncommented and modified, and the `IterateSyntaxTreeForStringLiterals` method has been commented out. The `IsStringToken` method now checks for different `SyntaxKind` types.
1. The `IterateSyntaxTreeForStringLiterals` method has been commented out, disabling its execution.
2. The `IterateSyntaxTreeForPragmas` method has been uncommented and modified. The `token` variable now refers to `pragmaSyntax` and the `IsAttributeNamePragmaToken` method checks the `PragmaContent` of the `token`.
3. The `AddToDictionaryIfLocalizedString` method's parameter type has been changed from `ISyntaxToken` to `PragmaSyntax`. The `TryToGetLocalizedStrings` method now checks the `PragmaContent` of the `token`.
4. The `pos` variable in the `AddToDictionaryIfLocalizedString` method now gets its value from `token.SourceText.GetLineSpan(token.Span).StartLinePosition`.
5. The `IsPragmaToken` and `IsStringToken` methods' parameter type has been changed from `ISyntaxToken` to `PragmaSyntax`. The check for `SyntaxKind.PragmaToken` in `IsPragmaToken` has been commented out.
6. The `IsStringToken` method now checks if the `SyntaxKind` of the `token` is `TypedStringDToken`, `TypedStringSToken`, `UntypedStringDToken`, or `UntypedStringSToken`.
* The most significant changes involve updates to the `CsOnlinerSourceBuilder` and `CsPlainSourceBuilder` classes, which now filter `UsingDirectives` based on the presence of the namespace's fully qualified name in the semantic tree of the compilation. This is achieved through a LINQ query.
Changes:
1. The `CsOnlinerSourceBuilder` and `CsPlainSourceBuilder` classes have been updated to filter `UsingDirectives` based on whether the fully qualified name of the namespace is present in the semantic tree of the compilation. This is done using a LINQ query that checks if the `FullyQualifiedName` of each namespace in the semantic tree is contained in the `QualifiedIdentifierList` of the `UsingDirectives`.
* asp
* fixies the issue with formating in library metadata
* mend
* clup
* clup
---
GitVersion.yml | 2 +-
.../AXSharp.Compiler/AXSharp.Compiler.csproj | 22 +-
.../src/AXSharp.Compiler/AXSharpProject.cs | 25 +-
.../AXSharp.Compiler/Core/IxNodeVisitor.cs | 230 +++---
.../Onliner/CsOnlinerSourceBuilder.cs | 45 +-
.../Plain/CsPlainSourceBuilder.cs | 34 +-
.../src/ixc/AXSharp.ixc.csproj | 3 +-
.../src/ixc/Properties/launchSettings.json | 13 +-
.../src/ixd/AXSharp.ixd.csproj | 9 +-
src/AXSharp.compiler/src/ixd/Program.cs | 4 +-
.../src/ixd/Visitors/MyNodeVisitor.cs | 16 +-
.../src/ixr/AXSharp.ixr.csproj | 11 +-
src/AXSharp.compiler/src/ixr/Program.cs | 42 +-
.../AXSharp.Compiler.CsTests.csproj | 37 +-
.../Cs/CsSourceBuilderTests.cs | 14 +
.../IxProjectTests.IntegrationCs.cs | 6 +-
.../.g/Onliners/abstract_members.g.cs | 232 ++++++
.../.g/Onliners/file_with_usings.g.cs | 772 ++++++++++++++++++
.../units/expected/.g/Onliners/generics.g.cs | 583 +++++++++++++
.../expected/.g/POCO/abstract_members.g.cs | 11 +
.../expected/.g/POCO/file_with_usings.g.cs | 23 +-
.../units/expected/.g/POCO/generics.g.cs | 23 +
.../samples/units/src/abstract_members.st | 8 +
.../samples/units/src/file_with_usings.st | 29 +-
.../samples/units/src/generics.st | 28 +
.../AXSharp.CompilerTests.csproj | 3 +
.../Core/IxNodeVisitorTests.cs | 114 +--
.../Core/IxNodeVisitorTestsSemantics.cs | 290 +++----
src/Directory.Packages.props | 4 +-
src/apax/apax-lock.json | 34 +-
src/apax/apax.yml | 4 +-
.../ix/.g/POCO/configuration.g.cs | 3 +-
.../.g/POCO/configuration.g.cs | 3 +-
.../axsharpblazor.twin/axsharpblazor.csproj | 21 +
34 files changed, 2263 insertions(+), 435 deletions(-)
create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/abstract_members.g.cs
create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/generics.g.cs
create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/abstract_members.g.cs
create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/generics.g.cs
create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/abstract_members.st
create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/generics.st
create mode 100644 templates/working/templates/axsharpblazor/axsharpblazor.twin/axsharpblazor.csproj
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