Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Poco array fields are null #312

Merged
merged 3 commits into from
May 10, 2024
Merged

Conversation

IX-BOT
Copy link
Contributor

@IX-BOT IX-BOT commented May 10, 2024

We now initialize complex arrays in the poco object to prevent null ref. cxception when the POCO object is not fully initialized.

Changes:

  1. Addition of CsPlainConstructorBuilder.cs file: This new file contains the CsPlainConstructorBuilder class, which is used to build constructors for classes. It implements the ICombinedThreeVisitor interface and contains methods for creating different types of declarations and adding them to the source code. It also contains a Create method which is used to create a new instance of the CsPlainConstructorBuilder class and add the constructor to the source code.

  2. Modification of CsPlainSourceBuilder.cs file: The using AXSharp.Compiler.Cs.Onliner; directive was added to allow the CsPlainSourceBuilder class to use the CsPlainConstructorBuilder class. The CsPlainConstructorBuilder.Create method was added to the CreateClassDeclaration method, creating a new instance of the CsPlainConstructorBuilder class and adding the constructor to the source code.

  3. Addition of InstantiateArray method in Arrays.cs file: This new method is used to create a new array and initialize it with a specified initializer function and array bounds.

  4. Commenting out of array initialization in PlainersSwappingTests.cs file: The code for initializing the ArrayOfDrives array was commented out, suggesting that the array is now being initialized elsewhere, possibly in the constructor of the p object.

closes #311

IX-BOT and others added 3 commits May 10, 2024 18:35
…tructorBuilder.cs` file and modifications to the `CsPlainSourceBuilder.cs` file. The new file contains the `CsPlainConstructorBuilder` class, which is used to build constructors for classes. The `CsPlainSourceBuilder.cs` file was updated to use this new class, specifically the `Create` method, to add constructors to the source code. Additionally, the `Arrays.cs` file was updated with a new method for creating and initializing arrays, and the `PlainersSwappingTests.cs` file had code for initializing an array commented out.

Changes:

1. Addition of `CsPlainConstructorBuilder.cs` file: This new file contains the `CsPlainConstructorBuilder` class, which is used to build constructors for classes. It implements the `ICombinedThreeVisitor` interface and contains methods for creating different types of declarations and adding them to the source code. It also contains a `Create` method which is used to create a new instance of the `CsPlainConstructorBuilder` class and add the constructor to the source code.

2. Modification of `CsPlainSourceBuilder.cs` file: The `using AXSharp.Compiler.Cs.Onliner;` directive was added to allow the `CsPlainSourceBuilder` class to use the `CsPlainConstructorBuilder` class. The `CsPlainConstructorBuilder.Create` method was added to the `CreateClassDeclaration` method, creating a new instance of the `CsPlainConstructorBuilder` class and adding the constructor to the source code.

3. Addition of `InstantiateArray` method in `Arrays.cs` file: This new method is used to create a new array and initialize it with a specified initializer function and array bounds.

4. Commenting out of array initialization in `PlainersSwappingTests.cs` file: The code for initializing the `ArrayOfDrives` array was commented out, suggesting that the array is now being initialized elsewhere, possibly in the constructor of the `p` object.
@PTKu PTKu marked this pull request as ready for review May 10, 2024 18:13
@PTKu PTKu merged commit f72e44b into dev May 10, 2024
2 checks passed
@PTKu PTKu deleted the 311-_BUG_Poco_array_fields_are_null branch May 10, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Poco array fields are null
2 participants