Skip to content

feat: support using decl types for in/out - #256

Merged
WerWolv merged 3 commits into
WerWolv:masterfrom
neptuwunium:feat/in-out-using
Sep 13, 2026
Merged

WerWolv merged 3 commits into
WerWolv:masterfrom
neptuwunium:feat/in-out-using

Conversation

@neptuwunium

Copy link
Copy Markdown
Contributor

Brought up here: WerWolv/ImHex#2890 (comment)

But using decls don't work at all even for builtin types. This fixes that.

Comment thread lib/source/pl/core/parser.cpp Outdated
} else if (const auto typeDecl = dynamic_cast<ast::ASTNodeTypeDecl*>(type->getType().get()); typeDecl != nullptr) {
if (const auto enumDecl = dynamic_cast<ast::ASTNodeEnum*>(typeDecl->getType().get()); enumDecl == nullptr) {
auto visitingType = type;
auto declNestLimit = 128; // some high value so infinite recursion breaks

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kek

This made me discover that this code is in fact valid and triggers the evaluation depth limit. I didn't think we could have recursive type definitions like that

using A;

using B = A;
using A = B;

A a @ 0x00;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's scary

Comment thread lib/source/pl/core/parser.cpp Outdated
Comment thread lib/source/pl/core/parser.cpp
Comment thread lib/source/pl/core/parser.cpp Outdated
@neptuwunium
neptuwunium requested a review from WerWolv September 12, 2026 15:41
@WerWolv
WerWolv merged commit 300d738 into WerWolv:master Sep 13, 2026
4 checks passed
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.

2 participants