Skip to content

Make a.b() always a method call, refactor how methods are represented in the compiler #3446

Closed
@nikomatsakis

Description

@nikomatsakis

We have agreement that the syntax expr.m() will always represent a method call (and never a call to the field expr.m). This allows us to make a change to the compiler AST so that we have expr_mcall() (method call) and not expr_call(expr_field()), which in turn allows various other simplifications in borrowck, trans, and elsewhere. In the process---or, perhaps, as first steps---I want to do some smaller refactorings:

  • Represent vtables as a tree and not the current flattened representation. This will simplify code all over the place.
  • Remove the callee_id and just hang method information off in different tables (this basically requires an expr_mcall)
  • Maybe: change how operator overloading is implemented so that, from the front end's point of view, all overloadable operations are method calls, but some of them call "intrinsic" methods. Constant expressions are therefore restricted to such intrinsics, and of course trans will generate a+b the same way it does today.

Metadata

Metadata

Assignees

Labels

A-codegenArea: Code generationA-type-systemArea: Type systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions