Skip to content

Decorators WIP #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 91 commits into from
Closed

Decorators WIP #1

wants to merge 91 commits into from

Conversation

pzuraq
Copy link
Owner

@pzuraq pzuraq commented Apr 5, 2021

No description provided.

ljharb and others added 30 commits January 19, 2021 13:17
The nonterminals:
- FunctionExpression
- ClassExpression
- GeneratorExpression
- AsyncGeneratorExpression

are all defined with a single RHS involving an optional BindingIdentifier.

But AsyncFunctionExpression is defined with two RHSs, one with a BindingIdentifier and one without.
(It's been that way since it was introduced in PR tc39#692)
I can't see any reason for it to be not like the others.
Published snapshots such as https://262.ecma-international.org/11.0/ include the exact same text. This patch tweaks the text so that the sentence still makes sense even when it’s being read from a snapshot copy. It also hardcodes the link’s target URL so that the link text and destination are always in sync and point to the expected location.
…c39#2189)

Co-authored-by: Ryan Duffy <[email protected]>
Co-authored-by: Michael Ficarra <[email protected]>
Co-authored-by: Kevin Gibbons <[email protected]>
Both S and R are Strings, so either both or neither should be asserted in the steps. I chose neither.
The spec has only one occurrence of:
    "For each ... that satisfies ..."
but six of:
    "For each ... such that ..."
so change the former to the latter.
... in the only occurrence of "For each non-negative integer",
to match the 4 existing occurrences of "For each integer".
The form
    "For each [element] of [list], in original key insertion order"
(or "... original insertion order") is weird because it implies that
it's not enough to know the order of the elements in the List,
you also have to know the order that they were inserted into the List.
But in fact, that's not necessary: in every case where this form is used,
the insertion order is the *same* as the List order,
because insertions only happen via appending to the List.

Map.prototype.forEach:
  Iterates over _map_.[[MapData]],
  whose only inserts are appends, in Map.prototype.set.

Set.prototype.forEach:
  Iterates over _set_.[[SetData]],
  whose only inserts are appends, in Set.prototype.add.

TriggerPromiseReactions:
  Iterates over _reactions_, which is
  _promise_.[[PromiseFulfillReactions]] or
  _promise_.[[PromiseRejectReactions]],
  whose only inserts are appends, in PerformPromiseThen.
…, private methods & getters/setters

This includes changes from https://tc39.es/proposal-class-fields/.
This includes changes from https://tc39.es/proposal-private-methods/.
This includes changes from https://tc39.es/proposal-static-class-features/.

Co-authored-by: Ms2ger <[email protected]>
Co-authored-by: Ujjwal Sharma <[email protected]>
Co-authored-by: Caio Lima <[email protected]>
Co-authored-by: Michael Dyck <[email protected]>
Co-authored-by: Kevin Gibbons <[email protected]>
Co-authored-by: Jordan Harband <[email protected]>
spec.html Outdated
Comment on lines 3551 to 3556
<emu-clause id="sec-map-specification-type">
<h1>The Map Specification Types</h1>
<p>The <dfn>Map</dfn> type is used to explain the evaluation of key-value based data structures, such as the metadata data structure built up by decorators (see <emu-xref href="#sec-metadata-record-specification-type"></emu-xref>). Values of the Map type are ordered sequences of key/value pairs containing individual values. These sequences may be of any length. The elements of a map may be randomly accessed using key-based indices. For notational convenience a dynamic-key syntax can be used to access Map elements. For example, _publicMetadata_[*"key"*] is shorthand for saying the value associated with *"key"* in the Map _publicMetadata_. If the map does not have a value associated with that key, then it returns ~empty~.</p>

<p>Maps can be iterated like lists, and are iterated as key/value pairs. If no order is specified, then elements are iterated in the order they were inserted.</p>
</emu-clause>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this type at all? couldn't we make a null object (one that's never observed to exist) and use that for the lookups?

[[DecoratorInitializers]]
</td>
<td>
a list of ECMAScript function objects, or ~empty~
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
a list of ECMAScript function objects, or ~empty~
a List of ECMAScript function objects, or ~empty~

any reason not to default it to an empty List?

[[FinisherInitializers]]
</td>
<td>
a list of ECMAScript function objects, or ~empty~
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
a list of ECMAScript function objects, or ~empty~
a List of ECMAScript function objects, or ~empty~

same question

[[Initializers]]
</td>
<td>
a list of ECMAScript function objects, or ~empty~
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
a list of ECMAScript function objects, or ~empty~
a List of ECMAScript function objects, or ~empty~

here also

@pzuraq pzuraq force-pushed the decorators branch 2 times, most recently from 484b92d to f004418 Compare May 26, 2021 23:26
jmdyck and others added 22 commits May 28, 2021 07:49
Please check that I've made the correct replacement!
Please check that I've made the correct replacements
(otherwise _metadataObjForKey_ wouldn't always be defined subequently)
or at least, not one that a function should be returning.
so that it's defined for the call to ClassElementEvaluation
Every call to CreateDecoratorContextObject assumes that this parameter is there.

(Of course, you'll need to add steps to *do* something with it.)
... to conform to what it accepts.
@pzuraq
Copy link
Owner Author

pzuraq commented May 28, 2021

Moved to tc39#2417

@pzuraq pzuraq closed this May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.