Skip to content

codegen: implement HirIsInstance for instanceof builtin - #107

Open
SAY-5 wants to merge 2 commits into
luz-lang:masterfrom
SAY-5:fix/instanceof-codegen-101
Open

codegen: implement HirIsInstance for instanceof builtin#107
SAY-5 wants to merge 2 commits into
luz-lang:masterfrom
SAY-5:fix/instanceof-codegen-101

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Closes #101.

expr() in ccodegen.cpp had no case HirKind::IsInstance: so instanceof() always fell through to default: return "0". The constructor now tags each luz_dict_new() instance with a __class__ field, and the new arm walks the compile-time parent chain in classes_ to emit a strcmp-based check that respects inheritance.

@SAY-5
SAY-5 force-pushed the fix/instanceof-codegen-101 branch from f634d79 to e7a13c9 Compare May 28, 2026 08:25
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.

[luzc] instanceof() always returns false — HirIsInstance unhandled in codegen

1 participant