traits: implement full trait support with code generation #1

Open
jnana wants to merge 4 commits from jnana/traits into main AGit
First-time contributor
  • Add Trait/Enum/ReadOnly tokens to lexer
  • Implement parseTrait/parseEnum/parseTraitUse in parser
  • Add TraitDecl/TraitUse/EnumDecl AST nodes
  • Store trait declarations during loadReferencedClasses
  • Emit trait method functions before init()
  • Copy trait properties and methods into classes that use them
  • Add tests for basic, single, and multiple trait usage
  • Update ROADMAP with traits status
- Add Trait/Enum/ReadOnly tokens to lexer - Implement parseTrait/parseEnum/parseTraitUse in parser - Add TraitDecl/TraitUse/EnumDecl AST nodes - Store trait declarations during loadReferencedClasses - Emit trait method functions before init() - Copy trait properties and methods into classes that use them - Add tests for basic, single, and multiple trait usage - Update ROADMAP with traits status
PR #3 changed foreach to clone the array before iterating (copy-on-iterate, matching PHP), so the bullet claiming it walks the live array is now false.
Merged PR #3 implemented it, closing the Maybe later item.
Covers the PR #3 behavior: appending inside foreach does not affect iteration (3 iterations, 6 elements afterwards), and unsetting an element inside foreach does not affect iteration (all three values visited).
- Add Trait/Enum/ReadOnly tokens to lexer
- Implement parseTrait/parseEnum/parseTraitUse in parser
- Add TraitDecl/TraitUse/EnumDecl AST nodes
- Store trait declarations during loadReferencedClasses
- Emit trait method functions before init()
- Copy trait properties and methods into classes that use them
- Add tests for basic, single, and multiple trait usage
- Update ROADMAP with traits status
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin +refs/pull/1/head:jnana/traits
git switch jnana/traits

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff jnana/traits
git switch jnana/traits
git rebase main
git switch main
git merge --ff-only jnana/traits
git switch jnana/traits
git rebase main
git switch main
git merge --no-ff jnana/traits
git switch main
git merge --squash jnana/traits
git switch main
git merge --ff-only jnana/traits
git switch main
git merge jnana/traits
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Milo/pic!1
No description provided.