Skip to content

All IR nodes should have a valid source #38

@cd1m0

Description

@cd1m0

During development I often used NoSrc for some nodes for which it wasn't clear what node they corresponded to. We should fix this.
There are 2 potential directions we can go to:

  1. We make all sources an instance of ASTSource, and just use that as source information. Source wouldn't carry any more information beyond just what location in the original code does this roughly correspond to.

  2. We have multiple classes for the various "source" relations. For example, given this piece of code:

  uint[] memory a;
  ...
  foo(a):

Where foo(uint[] storage) expect storage, a call to some copy function is emitted in the IR for the implict cast. We can have a special class ImplicitCast that tracks that this call is due to the implicit cast of the argument a.

Not sure if 2 is worth it? Might be overkill. Also its possible to just go with (1) for now and eventually convert to 2 if we feel we need the extra info? Need to think a bit more on this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions