Skip to content
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

Provide an API to query information about a record's *type* #2008

Open
oxisto opened this issue Jan 30, 2025 · 0 comments
Open

Provide an API to query information about a record's *type* #2008

oxisto opened this issue Jan 30, 2025 · 0 comments

Comments

@oxisto
Copy link
Member

oxisto commented Jan 30, 2025

Currently, we are often using the fields and methods properties of a RecordDeclaration to determine certain aspects of a class, e.g.,. its fields or methods. However, the aforementioned fields are actually only designed to hold real AST fields. This poses a problem for languages where parts of the definitions are outside of the class structure or can happen outside the class structure. (e.g., Python or Go). For example, in Go, fields are part of the class AST structure, methods are not. In order to resolve fields, we used to put them into the fields property, even though they are not part of the record class AST.

After #2001 this is finally not needed anymore and we should not do that (see also discussion in #1602). We should only place elements there that are syntactically there - otherwise we get a lot of issues with the EOG and other passes.

However, we still want to be able to query certain aspects of the concept "class", so my suggestion would be to extend the ObjectType (or maybe first introduce a RecordType / ClassType) to include an interface to quickly query all of the fields and methods based on the symbols available in the record's scope.

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

No branches or pull requests

1 participant