Skip to content

Parser: parse trait and impl bodies into the AST #64

Description

@StreamDemon

Summary

trait_def and impl_block skip their bodies (skip_item_body) — associated items (method signatures, associated types/consts, default methods, impl methods) are not parsed into the AST. Trait stores only a name; ImplBlock stores only a target type.

Part of the v0.6.x parser-completeness work (see crates/AGENTS.md "Implemented subset").

Spec

  • §3.5 traits/impls, supertraits; §16 trait_item / impl_item. (The §10 orphan rule is a later semantic concern, not parsing.)

Scope

  • Parse trait bodies: method signatures (no body), default methods (with body), associated type / const.
  • Parse impl bodies: methods and associated items; capture impl Trait for Type vs. inherent impl Type, and any supertrait/for target.
  • AST nodes for trait/impl items.
  • Corpus + unit tests.

Notes

Reuses function_after_mods for methods. Coordinate with the generics issue so impl<T> / trait T<U> parameters are captured.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions