Skip to content

Commit 94d2916

Browse files
committed
Refactor: Remove properties, add collection methods
Updated `TestCollectionOrderer` attribute namespace in `DisplayNameOrderer.cs`. Removed various `Onliner` type properties and `Parent` and `Interpreter` properties across multiple classes and namespaces. Added methods `GetChildren`, `GetKids`, and `GetValueTags` to return collections of children, elements, and value tags. Updated `units.csproj` to target `net9.0` and updated package references.
1 parent ff91831 commit 94d2916

File tree

70 files changed

+292
-526
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+292
-526
lines changed

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/DisplayNameOrderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
using Xunit.Abstractions;
99

10-
[assembly: TestCollectionOrderer("AXSharp.CompilerTests.DisplayNameOrderer", "AXSharp.CompilerTests")]
10+
[assembly: TestCollectionOrderer("AXSharp.Compiler.CsTests.DisplayNameOrderer", "AXSharp.Compiler.CsTests")]
1111
[assembly: CollectionBehavior(DisableTestParallelization = true)]
1212

1313
namespace AXSharp.Compiler.CsTests;

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/abstract_members.g.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
public partial class AbstractMotor : AXSharp.Connector.ITwinObject
99
{
1010
public OnlinerBool Run { get; }
11-
1211
public OnlinerBool ReverseDirection { get; }
1312

1413
partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
@@ -158,18 +157,21 @@ public void Poll()
158157
}
159158

160159
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
160+
161161
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
162162
{
163163
return Children;
164164
}
165165

166166
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
167+
167168
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
168169
{
169170
return Kids;
170171
}
171172

172173
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
174+
173175
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
174176
{
175177
return ValueTags;
@@ -226,8 +228,6 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
226228
}
227229

228230
protected System.String @SymbolTail { get; set; }
229-
230231
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
231-
232232
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
233233
}

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/array_declaration.g.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace ArrayDeclarationSimpleNamespace
1010
public partial class array_declaration_class : AXSharp.Connector.ITwinObject
1111
{
1212
public OnlinerInt[] primitive { get; }
13-
1413
public ArrayDeclarationSimpleNamespace.some_complex_type[] complex { get; }
1514

1615
partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
@@ -182,18 +181,21 @@ public ArrayDeclarationSimpleNamespace.Pocos.array_declaration_class CreateEmpty
182181
}
183182

184183
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
184+
185185
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
186186
{
187187
return Children;
188188
}
189189

190190
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
191+
191192
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
192193
{
193194
return Kids;
194195
}
195196

196197
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
198+
197199
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
198200
{
199201
return ValueTags;
@@ -250,9 +252,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
250252
}
251253

252254
protected System.String @SymbolTail { get; set; }
253-
254255
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
255-
256256
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
257257
}
258258

@@ -375,18 +375,21 @@ public ArrayDeclarationSimpleNamespace.Pocos.some_complex_type CreateEmptyPoco()
375375
}
376376

377377
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
378+
378379
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
379380
{
380381
return Children;
381382
}
382383

383384
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
385+
384386
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
385387
{
386388
return Kids;
387389
}
388390

389391
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
392+
390393
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
391394
{
392395
return ValueTags;
@@ -443,9 +446,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
443446
}
444447

445448
protected System.String @SymbolTail { get; set; }
446-
447449
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
448-
449450
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
450451
}
451452
}

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_all_primitives.g.cs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,26 @@
88
public partial class class_all_primitives : AXSharp.Connector.ITwinObject
99
{
1010
public OnlinerBool myBOOL { get; }
11-
1211
public OnlinerByte myBYTE { get; }
13-
1412
public OnlinerWord myWORD { get; }
15-
1613
public OnlinerDWord myDWORD { get; }
17-
1814
public OnlinerLWord myLWORD { get; }
19-
2015
public OnlinerSInt mySINT { get; }
21-
2216
public OnlinerInt myINT { get; }
23-
2417
public OnlinerDInt myDINT { get; }
25-
2618
public OnlinerLInt myLINT { get; }
27-
2819
public OnlinerUSInt myUSINT { get; }
29-
3020
public OnlinerUInt myUINT { get; }
31-
3221
public OnlinerUDInt myUDINT { get; }
33-
3422
public OnlinerULInt myULINT { get; }
35-
3623
public OnlinerReal myREAL { get; }
37-
3824
public OnlinerLReal myLREAL { get; }
39-
4025
public OnlinerTime myTIME { get; }
41-
4226
public OnlinerLTime myLTIME { get; }
43-
4427
public OnlinerDate myDATE { get; }
45-
4628
public OnlinerTimeOfDay myTIME_OF_DAY { get; }
47-
4829
public OnlinerDateTime myDATE_AND_TIME { get; }
49-
5030
public OnlinerString mySTRING { get; }
51-
5231
public OnlinerWString myWSTRING { get; }
5332

5433
partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
@@ -498,18 +477,21 @@ public void Poll()
498477
}
499478

500479
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
480+
501481
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
502482
{
503483
return Children;
504484
}
505485

506486
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
487+
507488
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
508489
{
509490
return Kids;
510491
}
511492

512493
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
494+
513495
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
514496
{
515497
return ValueTags;
@@ -566,8 +548,6 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
566548
}
567549

568550
protected System.String @SymbolTail { get; set; }
569-
570551
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
571-
572552
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
573553
}

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_extended_by_known_type.g.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ namespace Simatic.Ax.StateFramework
142142
public partial class AbstractState : AXSharp.Connector.ITwinObject, IState, IStateMuteable
143143
{
144144
public OnlinerInt StateID { get; }
145-
146145
public OnlinerString StateName { get; }
147146

148147
partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
@@ -292,18 +291,21 @@ public Simatic.Ax.StateFramework.Pocos.AbstractState CreateEmptyPoco()
292291
}
293292

294293
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
294+
295295
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
296296
{
297297
return Children;
298298
}
299299

300300
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
301+
301302
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
302303
{
303304
return Kids;
304305
}
305306

306307
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
308+
307309
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
308310
{
309311
return ValueTags;
@@ -360,9 +362,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
360362
}
361363

362364
protected System.String @SymbolTail { get; set; }
363-
364365
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
365-
366366
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
367367
}
368368
}

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_extends.g.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,21 @@ public void Poll()
253253
}
254254

255255
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
256+
256257
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
257258
{
258259
return Children;
259260
}
260261

261262
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
263+
262264
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
263265
{
264266
return Kids;
265267
}
266268

267269
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
270+
268271
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
269272
{
270273
return ValueTags;
@@ -321,8 +324,6 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
321324
}
322325

323326
protected System.String @SymbolTail { get; set; }
324-
325327
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
326-
327328
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
328329
}

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_extends_and_implements.g.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,21 @@ public void Poll()
253253
}
254254

255255
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
256+
256257
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
257258
{
258259
return Children;
259260
}
260261

261262
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
263+
262264
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
263265
{
264266
return Kids;
265267
}
266268

267269
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
270+
268271
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
269272
{
270273
return ValueTags;
@@ -321,9 +324,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
321324
}
322325

323326
protected System.String @SymbolTail { get; set; }
324-
325327
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
326-
327328
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
328329
}
329330

src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_generic_extension.g.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,21 @@ public Generics.Pocos.Extender CreateEmptyPoco()
126126
}
127127

128128
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
129+
129130
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
130131
{
131132
return Children;
132133
}
133134

134135
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
136+
135137
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
136138
{
137139
return Kids;
138140
}
139141

140142
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
143+
141144
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
142145
{
143146
return ValueTags;
@@ -194,16 +197,13 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
194197
}
195198

196199
protected System.String @SymbolTail { get; set; }
197-
198200
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
199-
200201
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
201202
}
202203

203204
public partial class Extendee : Generics.Extender<Generics.SomeType, Pocos.Generics.SomeType>
204205
{
205206
public Generics.SomeType SomeType { get; }
206-
207207
public Generics.SomeType SomeTypeAsPoco { get; }
208208

209209
partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
@@ -646,18 +646,21 @@ public Generics.Pocos.SomeType CreateEmptyPoco()
646646
}
647647

648648
private IList<AXSharp.Connector.ITwinObject> Children { get; } = new List<AXSharp.Connector.ITwinObject>();
649+
649650
public IEnumerable<AXSharp.Connector.ITwinObject> GetChildren()
650651
{
651652
return Children;
652653
}
653654

654655
private IList<AXSharp.Connector.ITwinElement> Kids { get; } = new List<AXSharp.Connector.ITwinElement>();
656+
655657
public IEnumerable<AXSharp.Connector.ITwinElement> GetKids()
656658
{
657659
return Kids;
658660
}
659661

660662
private IList<AXSharp.Connector.ITwinPrimitive> ValueTags { get; } = new List<AXSharp.Connector.ITwinPrimitive>();
663+
661664
public IEnumerable<AXSharp.Connector.ITwinPrimitive> GetValueTags()
662665
{
663666
return ValueTags;
@@ -714,9 +717,7 @@ public System.String GetHumanReadable(System.Globalization.CultureInfo culture)
714717
}
715718

716719
protected System.String @SymbolTail { get; set; }
717-
718720
protected AXSharp.Connector.ITwinObject @Parent { get; set; }
719-
720721
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
721722
}
722723
}

0 commit comments

Comments
 (0)