Skip to content

Commit

Permalink
Add Class and Class Element Decorators and accessor Keyword
Browse files Browse the repository at this point in the history
Updates

- Refactor to use ClassElementDefinition more extensively
- Separate parsing class elements and defining them so that we can
  control the order of definition and decorator application
- Extract and centralize class element decoration into a single place
- Fix completions in ClassDefinitionEvaluation (need to reset the env
  after each possible abrupt completion).
- Refactor adding private methods to instance to pull directly from
  `Class.[[Elements]]`, so we don't have multiple sources of truth for
  the elements that are defined on a class. `Class.[[Elements]]` is the
  canonical source of truth after ClassDefinitionEvaluation, and any
  operations afterward such as instantiation should base themselves on
  that.
- Refactor to use anonymous function syntax.

Non-normative fixes

Fixes based on feedback from @jmdyck

Remove dynamic [[HomeObject]] from decorator return values

Throw an error if the value passed to `addInitializer` is not callable

Set the name of the `addInitializer` function

Remove setFunctionName from decorator application

Call decorators with their natural `this` value.

For more details, see this issue: tc39/proposal-decorators#487

Reverse initializer order

Update field and accessor extra initializers to run after definition
  • Loading branch information
pzuraq committed Feb 2, 2024
1 parent 94bf7d5 commit 3f30554
Showing 1 changed file with 836 additions and 166 deletions.
Loading

0 comments on commit 3f30554

Please sign in to comment.