-
Notifications
You must be signed in to change notification settings - Fork 404
[Moore] [4/4] Implement direct class method calls #9136
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b970ca9 to
9dd6aed
Compare
46e17e5 to
483803b
Compare
483803b to
21ecdc8
Compare
c0f5c6c to
e00dc2a
Compare
Adds **class method declarations** and a **direct call op**, wires them into the importer, and supports implicit `this`, inherited property access, and upcasting. - **New ops** - `moore.class.methoddecl`: declare methods inside `classdecl` (FunctionType). - `moore.class.call`: direct (non-virtual) method call; verifies callee, arity, and types. - **Importer** - Lowers `t.m(...)` and unqualified `m(...)` (inside methods) to `class.call`. - Adds implicit `%this : !moore.class<@C>` as first block arg for methods. - Performs **implicit upcast** of the receiver when needed. - Resolves class properties via `class.property_ref` (now also for implicit `this`). - Clearer diag: prints SV type for unsupported member-access bases. - **Lowering plumbing** - `declareFunction` split into `declareCallableImpl` to share logic; supports methods (qualified name `@"Pkg::Class"::method`). - Tracks `currentThisRef` in `Context` for implicit `this` in expressions. - `ClassDeclVisitor` emits `class.methoddecl` in source order after lowering the method body. - **Verifiers / build** - `ClassDeclOp` verifier accepts `class.methoddecl`. - `ClassCallOp` verifier checks symbol -> function, FunctionType, operand types. - Includes/linkage for call interfaces (`MooreOps.h`, CMake). - **Tests** - `classes.sv`: calls on concrete classes, inherited property access through upcast, and method decls reflected in IR.
e00dc2a to
e313129
Compare
fabianschuiki
approved these changes
Oct 29, 2025
Contributor
fabianschuiki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for adding this 🙌
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds class method declarations, wires it into the importer, and supports implicit
this, inherited property access, and upcasting.New ops
moore.class.methoddecl: declare methods insideclassdecl(FunctionType).Importer
t.m(...)and unqualifiedm(...)(inside methods) tofunc.call.%this : !moore.class<@C>as first block arg for methods.class.property_ref(now also for implicitthis).Lowering plumbing
declareFunctionsplit intodeclareCallableImplto share logic; supports methods (qualified name@"Pkg::Class"::method).currentThisRefinContextfor implicitthisin expressions.ClassDeclVisitoremitsclass.methoddeclin source order after lowering the method body.Verifiers / build
ClassDeclOpverifier acceptsclass.methoddecl.MooreOps.h, CMake).Tests
classes.sv: calls on concrete classes, inherited property access through upcast, and method decls reflected in IR.