-
Couldn't load subscription status.
- Fork 383
[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
base: main
Are you sure you want to change the base?
Conversation
b970ca9 to
9dd6aed
Compare
46e17e5 to
483803b
Compare
483803b to
21ecdc8
Compare
| // Prefix the function name with the surrounding namespace to create somewhat | ||
| // sane names in the IR. | ||
| SmallString<64> funcName; | ||
| guessNamespacePrefix(subroutine.getParentScope()->asSymbol(), funcName); | ||
| funcName += subroutine.name; | ||
|
|
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.
Just out of curiosity: does the namespace prefix guessing not work if there are classes or modules around the function/subroutine?
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.
Yeah, it seems to not resolve package scope names or module scope names.
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
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.