From 7340307ce784c7948e407f8cc6a0371dae123ffd Mon Sep 17 00:00:00 2001 From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com> Date: Wed, 1 Apr 2026 12:13:06 +0200 Subject: [PATCH 1/2] Fix transpilation logic to exclude constant members and add expected output files for classes with constant members --- .../Helpers/SemanticsHelpers.cs | 9 +- .../Cs/CsSourceBuilderTests.cs | 6 + .../Onliners/class_with_constant_members.g.cs | 225 ++++++++++++++++++ .../.g/POCO/class_with_constant_members.g.cs | 18 ++ .../Onliners/class_with_constant_members.g.cs | 225 ++++++++++++++++++ .../.g/POCO/class_with_constant_members.g.cs | 18 ++ .../units/src/class_with_constant_members.st | 12 + 7 files changed, 510 insertions(+), 3 deletions(-) create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_constant_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_constant_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_constant_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_constant_members.g.cs create mode 100644 src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_constant_members.st diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs index 11905ef3..aef9f52b 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs @@ -34,9 +34,12 @@ public static (bool isEligible, ITypeDeclaration eligibleType) IsMemberEligibleF string coBuilder = "", bool warnMissingOrInconsistent = false) { var eligibility = field.IsEligibleForTranspile(sourceBuilder, warnMissingOrInconsistent); - var isEligible = ((field.AccessModifier == AccessModifier.Public || field.AccessModifier == AccessModifier.Protected || field.AccessModifier == AccessModifier.Internal) - && eligibility.isEligibe - && !IsToBeOmitted(field, sourceBuilder, coBuilder)); + var isEligible = ((field.AccessModifier == AccessModifier.Public || + field.AccessModifier == AccessModifier.Protected || + field.AccessModifier == AccessModifier.Internal) + && !field.IsConstant + && eligibility.isEligibe + && !IsToBeOmitted(field, sourceBuilder, coBuilder)); return (isEligible, eligibility.eligibleType); } 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 a9439f41..7a9375b6 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/Cs/CsSourceBuilderTests.cs @@ -283,6 +283,12 @@ public void abstract_members() } + [Fact] + public void class_with_constant_members() + { + CompareOutputs(GetMethodName()); + } + [Fact] public void generics() { diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_constant_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_constant_members.g.cs new file mode 100644 index 00000000..a6a023f8 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/Onliners/class_with_constant_members.g.cs @@ -0,0 +1,225 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithConstantMembersNamespace +{ + public partial class ClassWithConstantMembers : AXSharp.Connector.ITwinObject + { + public OnlinerInt myNonConstant { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithConstantMembers(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); + myNonConstant = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myNonConstant", "myNonConstant"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain = new global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers(); + await this.ReadAsync(priority); + plain.myNonConstant = myNonConstant.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() + { + global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain = new global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers(); + plain.myNonConstant = myNonConstant.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(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain) + { + plain.myNonConstant = myNonConstant.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + myNonConstant.LethargicWrite(plain.myNonConstant); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [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(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain) + { +#pragma warning disable CS0612 + myNonConstant.LethargicWrite(plain.myNonConstant); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain = new global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers(); + plain.myNonConstant = myNonConstant.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain) + { + plain.myNonConstant = myNonConstant.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain) + { + myNonConstant.Shadow = plain.myNonConstant; + 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(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain, global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.myNonConstant != myNonConstant.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers CreateEmptyPoco() + { + return new global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers(); + } + + 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) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + 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/ax/.g/POCO/class_with_constant_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_constant_members.g.cs new file mode 100644 index 00000000..124a4602 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/ax/.g/POCO/class_with_constant_members.g.cs @@ -0,0 +1,18 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithConstantMembersNamespace + { + public partial class ClassWithConstantMembers : AXSharp.Connector.IPlain + { + public ClassWithConstantMembers() + { + } + + public Int16 myNonConstant { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_constant_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_constant_members.g.cs new file mode 100644 index 00000000..a6a023f8 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/Onliners/class_with_constant_members.g.cs @@ -0,0 +1,225 @@ +using System; +using AXSharp.Connector; +using AXSharp.Connector.ValueTypes; +using System.Collections.Generic; +using AXSharp.Connector.Localizations; +using AXSharp.Abstractions.Presentation; + +namespace ClassWithConstantMembersNamespace +{ + public partial class ClassWithConstantMembers : AXSharp.Connector.ITwinObject + { + public OnlinerInt myNonConstant { get; } + + partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail); + public ClassWithConstantMembers(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); + myNonConstant = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "myNonConstant", "myNonConstant"); + parent.AddChild(this); + parent.AddKid(this); + PostConstruct(parent, readableTail, symbolTail); + } + + public async virtual Task OnlineToPlain(eAccessPriority priority = eAccessPriority.Normal) + { + return await (dynamic)this.OnlineToPlainAsync(priority); + } + + public async Task OnlineToPlainAsync(eAccessPriority priority = eAccessPriority.Normal) + { + global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain = new global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers(); + await this.ReadAsync(priority); + plain.myNonConstant = myNonConstant.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() + { + global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain = new global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers(); + plain.myNonConstant = myNonConstant.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(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain) + { + plain.myNonConstant = myNonConstant.LastValue; + return plain; + } + + public async virtual Task PlainToOnline(T plain, eAccessPriority priority = eAccessPriority.Normal) + { + await this.PlainToOnlineAsync((dynamic)plain, priority); + } + + public async Task> PlainToOnlineAsync(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain, eAccessPriority priority = eAccessPriority.Normal) + { +#pragma warning disable CS0612 + myNonConstant.LethargicWrite(plain.myNonConstant); +#pragma warning restore CS0612 + return await this.WriteAsync(priority); + } + + [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(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain) + { +#pragma warning disable CS0612 + myNonConstant.LethargicWrite(plain.myNonConstant); +#pragma warning restore CS0612 + } + + public async virtual Task ShadowToPlain() + { + return await (dynamic)this.ShadowToPlainAsync(); + } + + public async Task ShadowToPlainAsync() + { + global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain = new global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers(); + plain.myNonConstant = myNonConstant.Shadow; + return plain; + } + + protected async Task ShadowToPlainAsync(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain) + { + plain.myNonConstant = myNonConstant.Shadow; + return plain; + } + + public async virtual Task PlainToShadow(T plain) + { + await this.PlainToShadowAsync((dynamic)plain); + } + + public async Task> PlainToShadowAsync(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain) + { + myNonConstant.Shadow = plain.myNonConstant; + 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(global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers plain, global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers latest = null) + { + if (latest == null) + latest = await this._OnlineToPlainNoacAsync(); + var somethingChanged = false; + return await Task.Run(async () => + { + if (plain.myNonConstant != myNonConstant.LastValue) + somethingChanged = true; + plain = latest; + return somethingChanged; + }); + } + + public void Poll() + { + this.RetrievePrimitives().ToList().ForEach(x => x.Poll()); + } + + public global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers CreateEmptyPoco() + { + return new global::Pocos.ClassWithConstantMembersNamespace.ClassWithConstantMembers(); + } + + 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) + { + if (string.IsNullOrEmpty(_attributeName)) + { + return SymbolTail; + } + + 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/tia/.g/POCO/class_with_constant_members.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_constant_members.g.cs new file mode 100644 index 00000000..124a4602 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/tia/.g/POCO/class_with_constant_members.g.cs @@ -0,0 +1,18 @@ +using System; +using AXSharp.Abstractions.Presentation; +using AXSharp.Connector; + +namespace Pocos +{ + namespace ClassWithConstantMembersNamespace + { + public partial class ClassWithConstantMembers : AXSharp.Connector.IPlain + { + public ClassWithConstantMembers() + { + } + + public Int16 myNonConstant { get; set; } + } + } +} \ No newline at end of file diff --git a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_constant_members.st b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_constant_members.st new file mode 100644 index 00000000..9bf636e0 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_constant_members.st @@ -0,0 +1,12 @@ +NAMESPACE ClassWithConstantMembersNamespace + {S7.extern=ReadWrite} + CLASS PUBLIC ClassWithConstantMembers + VAR PUBLIC + myNonConstant : INT; + END_VAR + VAR CONSTANT + myConstant : INT := 10; + myConstantString : STRING := 'hello'; + END_VAR + END_CLASS +END_NAMESPACE \ No newline at end of file From b07436db814c8aecb8de5baf1c72793b848ede11 Mon Sep 17 00:00:00 2001 From: Peter Kurhajec <61538034+PTKu@users.noreply.github.com> Date: Wed, 1 Apr 2026 14:31:55 +0200 Subject: [PATCH 2/2] Add sample class with constant members for testing --- .../samples/units/src/class_with_constant_members.st | 0 .../samples/units/src/class_with_contant_members.st | 12 ++++++++++++ 2 files changed, 12 insertions(+) rename src/AXSharp.compiler/tests/{AXSharp.CompilerTests => AXSharp.Compiler.CsTests}/samples/units/src/class_with_constant_members.st (100%) create mode 100644 src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_contant_members.st diff --git a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_constant_members.st b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_constant_members.st similarity index 100% rename from src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_constant_members.st rename to src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/src/class_with_constant_members.st diff --git a/src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_contant_members.st b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_contant_members.st new file mode 100644 index 00000000..9bf636e0 --- /dev/null +++ b/src/AXSharp.compiler/tests/AXSharp.CompilerTests/samples/units/src/class_with_contant_members.st @@ -0,0 +1,12 @@ +NAMESPACE ClassWithConstantMembersNamespace + {S7.extern=ReadWrite} + CLASS PUBLIC ClassWithConstantMembers + VAR PUBLIC + myNonConstant : INT; + END_VAR + VAR CONSTANT + myConstant : INT := 10; + myConstantString : STRING := 'hello'; + END_VAR + END_CLASS +END_NAMESPACE \ No newline at end of file