Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e85418b
issue-2282: PL changes
shewitt-au May 31, 2025
bbace8d
Remove debugging code
shewitt-au May 31, 2025
9d63054
Hard to get every one. time...
shewitt-au May 31, 2025
db3c947
Hard to get every one
shewitt-au May 31, 2025
1b5c8f6
WIP
shewitt-au Jun 1, 2025
e1b869d
WIP
shewitt-au Jun 1, 2025
fdf3df4
WIP
shewitt-au Jun 1, 2025
ad24e44
WIP
shewitt-au Jun 1, 2025
c004860
WIP
shewitt-au Jun 1, 2025
b2606d8
WIP
shewitt-au Jun 1, 2025
1214cd8
WIP
shewitt-au Jun 1, 2025
4295ce6
WIP
shewitt-au Jun 1, 2025
5e0b38b
WIP
shewitt-au Jun 1, 2025
ab9a3a9
WIP
shewitt-au Jun 1, 2025
f7d6fc0
WIP
shewitt-au Jun 1, 2025
2ac6ba9
WIP
shewitt-au Jun 1, 2025
c5496e1
WIP
shewitt-au Jun 1, 2025
29be2d2
WIP
shewitt-au Jun 2, 2025
4e07ab2
Taking a slightly different approach
shewitt-au Jun 2, 2025
8ea5dc4
Add 'construct_shared_object.hpp'
shewitt-au Jun 2, 2025
324a136
WIP
shewitt-au Jun 2, 2025
3ec6ae2
WIP
shewitt-au Jun 2, 2025
9489b3c
It builds
shewitt-au Jun 2, 2025
c6095e6
Change comment
shewitt-au Jun 2, 2025
830d0ee
fix: post_construct not being called on some compilers
shewitt-au Jun 3, 2025
ce784c4
Attempt and strange problem casuing build isssues
shewitt-au Jun 3, 2025
32037d1
Attempt and strange problem casuing build isssues
shewitt-au Jun 3, 2025
8a008a2
Attempt and strange problem casuing build isssues
shewitt-au Jun 3, 2025
7c0884b
Replace more make_shared calls
shewitt-au Jun 3, 2025
a47cc5f
Work on unit tests
shewitt-au Jun 3, 2025
e1fd97a
Work on unit tests
shewitt-au Jun 3, 2025
b17db3f
Work on unit tests
shewitt-au Jun 3, 2025
093a4e1
Work on unit tests
shewitt-au Jun 3, 2025
c40fbe3
Work on unit tests
shewitt-au Jun 3, 2025
ab43e67
Work on unit tests
shewitt-au Jun 3, 2025
bb5bc62
Work on unit tests
shewitt-au Jun 3, 2025
36deb13
Fixing tests
shewitt-au Jun 4, 2025
3eb2833
Fixing tests
shewitt-au Jun 4, 2025
cab951b
Fixing tests
shewitt-au Jun 4, 2025
8e82fdd
Fixing tests
shewitt-au Jun 4, 2025
6173dfc
Fixing tests
shewitt-au Jun 4, 2025
21fa172
Make all patterns I could find have protected constructors
shewitt-au Jun 4, 2025
3291051
Change static cast to dynamic
shewitt-au Jun 5, 2025
29b7486
Moved friend declations to end of class
shewitt-au Jun 5, 2025
c308e82
New allocation method (WIP)
shewitt-au Jun 6, 2025
1fd2401
It's looking like it may actually buid. We'll soon know
shewitt-au Jun 6, 2025
e380aeb
Last claims premature
shewitt-au Jun 6, 2025
aaae498
Move stuff around
shewitt-au Jun 6, 2025
9694a1c
New allocation method. Other small changes
shewitt-au Jun 7, 2025
13ec0b8
Renamed some stuff
shewitt-au Jun 8, 2025
cbd3f62
Renamed some stuff
shewitt-au Jun 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/include/pl/patterns/pattern.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,7 @@ namespace pl::ptrn {
}

[[nodiscard]] virtual core::Token::Literal getValue() const {
auto clone = this->clone();

return this->transformValue(std::move(clone));
return this->transformValue(const_cast<Pattern*>(this)->reference());
}

[[nodiscard]] virtual std::vector<std::pair<u64, Pattern*>> getChildren() {
Expand Down Expand Up @@ -537,15 +535,15 @@ namespace pl::ptrn {
this->m_initialized = initialized;
}

[[nodiscard]] const Pattern* getParent() const {
[[nodiscard]] std::shared_ptr<const Pattern> getParent() const {
return m_parent;
}

[[nodiscard]] Pattern* getParent() {
[[nodiscard]] std::shared_ptr<Pattern> getParent() {
return m_parent;
}

void setParent(Pattern *parent) {
void setParent(std::shared_ptr<Pattern> parent) {
m_parent = parent;
}

Expand Down Expand Up @@ -623,7 +621,7 @@ namespace pl::ptrn {
core::Evaluator *m_evaluator;

std::unique_ptr<std::map<std::string, std::vector<core::Token::Literal>>> m_attributes;
Pattern *m_parent = nullptr;
std::shared_ptr<Pattern> m_parent;
u32 m_line = 0;

std::set<std::string>::const_iterator m_variableName;
Expand Down
6 changes: 3 additions & 3 deletions lib/include/pl/patterns/pattern_array_dynamic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ namespace pl::ptrn {
PatternArrayDynamic(const PatternArrayDynamic &other) : Pattern(other) {
std::vector<std::shared_ptr<Pattern>> entries;
for (const auto &entry : other.m_entries)
entries.push_back(entry->clone());
entries.push_back(entry);

this->setEntries(entries);
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternArrayDynamic(*this));
return std::shared_ptr<Pattern>(new PatternArrayDynamic(*this));
}

void setColor(u32 color) override {
Expand Down Expand Up @@ -133,7 +133,7 @@ namespace pl::ptrn {

if (!entry->hasOverriddenColor())
entry->setBaseColor(this->getColor());
entry->setParent(this);
entry->setParent(this->reference());

this->m_entries.emplace_back(entry);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/include/pl/patterns/pattern_array_static.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace pl::ptrn {
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternArrayStatic(*this));
return std::shared_ptr<Pattern>(new PatternArrayStatic(*this));
}

[[nodiscard]] std::shared_ptr<Pattern> getEntry(size_t index) const override {
Expand Down Expand Up @@ -153,7 +153,7 @@ namespace pl::ptrn {

void setEntries(std::shared_ptr<Pattern> &&templatePattern, size_t count) {
this->m_template = std::move(templatePattern);
this->m_template->setParent(this);
this->m_template->setParent(this->reference());
this->m_highlightTemplates.push_back(this->m_template->clone());
this->m_entryCount = count;

Expand Down
20 changes: 10 additions & 10 deletions lib/include/pl/patterns/pattern_bitfield.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace pl::ptrn {
[[nodiscard]] const PatternBitfieldMember& getTopmostBitfield() const {
const PatternBitfieldMember* topBitfield = this;
while (auto parent = topBitfield->getParent()) {
auto parentBitfield = dynamic_cast<const PatternBitfieldMember*>(parent);
auto parentBitfield = dynamic_cast<const PatternBitfieldMember*>(parent.get());
if (parentBitfield == nullptr)
break;

Expand Down Expand Up @@ -53,7 +53,7 @@ namespace pl::ptrn {

class PatternBitfieldField : public PatternBitfieldMember {
public:
PatternBitfieldField(core::Evaluator *evaluator, u64 offset, u8 bitOffset, u8 bitSize, u32 line, PatternBitfieldMember *parentBitfield = nullptr)
PatternBitfieldField(core::Evaluator *evaluator, u64 offset, u8 bitOffset, u8 bitSize, u32 line, std::shared_ptr<PatternBitfieldMember> parentBitfield = nullptr)
: PatternBitfieldMember(evaluator, offset, (bitOffset + bitSize + 7) / 8, line), m_bitOffset(bitOffset % 8), m_bitSize(bitSize) {
this->setParent(parentBitfield);
}
Expand All @@ -65,7 +65,7 @@ namespace pl::ptrn {
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternBitfieldField(*this));
return std::shared_ptr<Pattern>(new PatternBitfieldField(*this));
}

[[nodiscard]] u128 readValue() const {
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace pl::ptrn {
using PatternBitfieldField::PatternBitfieldField;

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternBitfieldFieldSigned(*this));
return std::shared_ptr<Pattern>(new PatternBitfieldFieldSigned(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand All @@ -186,7 +186,7 @@ namespace pl::ptrn {
using PatternBitfieldField::PatternBitfieldField;

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternBitfieldFieldBoolean(*this));
return std::shared_ptr<Pattern>(new PatternBitfieldFieldBoolean(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down Expand Up @@ -245,7 +245,7 @@ namespace pl::ptrn {
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternBitfieldFieldEnum(*this));
return std::shared_ptr<Pattern>(new PatternBitfieldFieldEnum(*this));
}

std::string formatDisplayValue() override {
Expand Down Expand Up @@ -282,7 +282,7 @@ namespace pl::ptrn {
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternBitfieldArray(*this));
return std::shared_ptr<Pattern>(new PatternBitfieldArray(*this));
}

[[nodiscard]] u8 getBitOffset() const override {
Expand Down Expand Up @@ -422,7 +422,7 @@ namespace pl::ptrn {
if (!entry->hasOverriddenColor())
entry->setBaseColor(this->getColor());

entry->setParent(this);
entry->setParent(this->reference());

this->m_sortedEntries.push_back(entry.get());
}
Expand Down Expand Up @@ -554,7 +554,7 @@ namespace pl::ptrn {
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternBitfield(*this));
return std::shared_ptr<Pattern>(new PatternBitfield(*this));
}

[[nodiscard]] u8 getBitOffset() const override {
Expand Down Expand Up @@ -643,7 +643,7 @@ namespace pl::ptrn {
this->setBaseColor(this->m_fields.front()->getColor());

for (const auto &field : this->m_fields) {
field->setParent(this);
field->setParent(this->reference());
this->m_sortedFields.push_back(field.get());
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_boolean.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, 1, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternBoolean(*this));
return std::shared_ptr<Pattern>(new PatternBoolean(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, size, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternEnum(*this));
return std::shared_ptr<Pattern>(new PatternEnum(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, size, line), m_errorMessage(std::move(errorMessage)) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternError(*this));
return std::shared_ptr<Pattern>(new PatternError(*this));
}

[[nodiscard]] std::string getFormattedName() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_float.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, size, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternFloat(*this));
return std::shared_ptr<Pattern>(new PatternFloat(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_padding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace pl::ptrn {
PatternPadding(core::Evaluator *evaluator, u64 offset, size_t size, u32 line) : Pattern(evaluator, offset, size, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternPadding(*this));
return std::shared_ptr<Pattern>(new PatternPadding(*this));
}

[[nodiscard]] std::string getFormattedName() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_pointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace pl::ptrn {
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternPointer(*this));
return std::shared_ptr<Pattern>(new PatternPointer(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_signed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, size, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternSigned(*this));
return std::shared_ptr<Pattern>(new PatternSigned(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, size, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternString(*this));
return std::shared_ptr<Pattern>(new PatternString(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
6 changes: 3 additions & 3 deletions lib/include/pl/patterns/pattern_struct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ namespace pl::ptrn {
for (const auto &member : other.m_members) {
auto copy = member->clone();

copy->setParent(this);
copy->setParent(this->reference());
this->m_sortedMembers.push_back(copy.get());
this->m_members.push_back(std::move(copy));
}
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternStruct(*this));
return std::shared_ptr<Pattern>(new PatternStruct(*this));
}

[[nodiscard]] std::shared_ptr<Pattern> getEntry(size_t index) const override {
Expand All @@ -36,7 +36,7 @@ namespace pl::ptrn {
void addEntry(const std::shared_ptr<Pattern> &entry) override {
if (entry == nullptr) return;

entry->setParent(this);
entry->setParent(this->reference());
this->m_sortedMembers.push_back(entry.get());
this->m_members.push_back(entry);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/include/pl/patterns/pattern_union.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ namespace pl::ptrn {

PatternUnion(const PatternUnion &other) : Pattern(other) {
for (const auto &member : other.m_members) {
auto copy = member->clone();
//auto copy = member->clone();

this->m_sortedMembers.push_back(copy.get());
this->m_members.push_back(std::move(copy));
this->m_sortedMembers.push_back(member.get());
this->m_members.push_back(member);
}
}

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternUnion(*this));
return std::shared_ptr<Pattern>(new PatternUnion(*this));
}

[[nodiscard]] std::shared_ptr<Pattern> getEntry(size_t index) const override {
Expand All @@ -35,7 +35,7 @@ namespace pl::ptrn {
void addEntry(const std::shared_ptr<Pattern> &entry) override {
if (entry == nullptr) return;

entry->setParent(this);
entry->setParent(this->reference());
this->m_sortedMembers.push_back(entry.get());
this->m_members.push_back(entry);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_unsigned.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, size, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternUnsigned(*this));
return std::shared_ptr<Pattern>(new PatternUnsigned(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_wide_character.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, 2, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternWideCharacter(*this));
return std::shared_ptr<Pattern>(new PatternWideCharacter(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
2 changes: 1 addition & 1 deletion lib/include/pl/patterns/pattern_wide_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace pl::ptrn {
: Pattern(evaluator, offset, size, line) { }

[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
return std::unique_ptr<Pattern>(new PatternWideString(*this));
return std::shared_ptr<Pattern>(new PatternWideString(*this));
}

[[nodiscard]] core::Token::Literal getValue() const override {
Expand Down
16 changes: 8 additions & 8 deletions lib/source/pl/core/ast/ast_node_array_variable_decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ namespace pl::core::ast {
}
}

if (dynamic_cast<ptrn::PatternPadding *>(templatePattern.get())) {
outputPattern = std::make_unique<ptrn::PatternPadding>(evaluator, startOffset, 0, getLocation().line);
} else if (dynamic_cast<ptrn::PatternCharacter *>(templatePattern.get())) {
outputPattern = std::make_unique<ptrn::PatternString>(evaluator, startOffset, 0, getLocation().line);
} else if (dynamic_cast<ptrn::PatternWideCharacter *>(templatePattern.get())) {
outputPattern = std::make_unique<ptrn::PatternWideString>(evaluator, startOffset, 0, getLocation().line);
if (std::dynamic_pointer_cast<ptrn::PatternPadding>(templatePattern)) {
outputPattern = std::make_shared<ptrn::PatternPadding>(evaluator, startOffset, 0, getLocation().line);
} else if (std::dynamic_pointer_cast<ptrn::PatternCharacter>(templatePattern)) {
outputPattern = std::make_shared<ptrn::PatternString>(evaluator, startOffset, 0, getLocation().line);
} else if (std::dynamic_pointer_cast<ptrn::PatternWideCharacter>(templatePattern)) {
outputPattern = std::make_shared<ptrn::PatternWideString>(evaluator, startOffset, 0, getLocation().line);
} else {
auto arrayPattern = std::make_unique<ptrn::PatternArrayStatic>(evaluator, startOffset, 0, getLocation().line);
auto arrayPattern = std::make_shared<ptrn::PatternArrayStatic>(evaluator, startOffset, 0, getLocation().line);
arrayPattern->setEntries(templatePattern->clone(), size_t(entryCount));
arrayPattern->setSection(templatePattern->getSection());
outputPattern = std::move(arrayPattern);
Expand Down Expand Up @@ -256,7 +256,7 @@ namespace pl::core::ast {
};

evaluator->alignToByte();
auto arrayPattern = std::make_unique<ptrn::PatternArrayDynamic>(evaluator, evaluator->getReadOffset(), 0, getLocation().line);
auto arrayPattern = std::make_shared<ptrn::PatternArrayDynamic>(evaluator, evaluator->getReadOffset(), 0, getLocation().line);
arrayPattern->setVariableName(this->m_name);
arrayPattern->setSection(evaluator->getSectionId());

Expand Down
4 changes: 2 additions & 2 deletions lib/source/pl/core/ast/ast_node_bitfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ namespace pl::core::ast {
}

for (auto &pattern : potentialPatterns) {
if (auto bitfieldMember = dynamic_cast<ptrn::PatternBitfieldMember*>(pattern.get()); bitfieldMember != nullptr) {
bitfieldMember->setParent(bitfieldPattern.get());
if (auto bitfieldMember = std::dynamic_pointer_cast<ptrn::PatternBitfieldMember>(pattern); bitfieldMember != nullptr) {
bitfieldMember->setParent(bitfieldPattern);
if (!bitfieldMember->isPadding())
fields.push_back(pattern);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace pl::core::ast {
};

auto position = evaluator->getBitwiseReadOffset();
auto arrayPattern = std::make_unique<ptrn::PatternBitfieldArray>(evaluator, position.byteOffset, position.bitOffset, 0, getLocation().line);
auto arrayPattern = std::make_shared<ptrn::PatternBitfieldArray>(evaluator, position.byteOffset, position.bitOffset, 0, getLocation().line);
arrayPattern->setVariableName(this->m_name);
arrayPattern->setSection(evaluator->getSectionId());
arrayPattern->setReversed(evaluator->isReadOrderReversed());
Expand Down Expand Up @@ -132,8 +132,8 @@ namespace pl::core::ast {
}

for (auto &pattern : entries) {
if (auto bitfieldMember = dynamic_cast<ptrn::PatternBitfieldMember*>(pattern.get()); bitfieldMember != nullptr)
bitfieldMember->setParent(arrayPattern.get());
if (auto bitfieldMember = std::dynamic_pointer_cast<ptrn::PatternBitfieldMember>(pattern); bitfieldMember != nullptr)
bitfieldMember->setParent(arrayPattern);
}

arrayPattern->setEntries(entries);
Expand Down
2 changes: 1 addition & 1 deletion lib/source/pl/core/ast/ast_node_bitfield_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace pl::core::ast {
evaluator->setBitwiseReadOffset(originalPosition);

if (auto *patternEnum = dynamic_cast<ptrn::PatternEnum *>(pattern.get()); patternEnum != nullptr) {
auto bitfieldEnum = std::make_unique<ptrn::PatternBitfieldFieldEnum>(evaluator, byteOffset, bitOffset, bitSize, getLocation().line);
auto bitfieldEnum = std::make_shared<ptrn::PatternBitfieldFieldEnum>(evaluator, byteOffset, bitOffset, bitSize, getLocation().line);
bitfieldEnum->setTypeName(patternEnum->getTypeName());
bitfieldEnum->setEnumValues(patternEnum->getEnumValues());
result = std::move(bitfieldEnum);
Expand Down
Loading
Loading