662 lines
62 KiB
HTML
662 lines
62 KiB
HTML
<!doctype html>
|
|
<head><meta charset="utf8">
|
|
<title>Decorators</title>
|
|
<link rel="stylesheet" href="./css/elements.css">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
|
|
</head><body><emu-biblio href="./biblio.json"></emu-biblio>
|
|
|
|
<h1>Decorators Proposal - ECMAScript</h1>
|
|
<div><h2>Table of Contents</h2><ol class="toc"><li><a href="#introduction"><span class="secnum"></span> Introduction</a></li><li><a href="#proposal-terms"><span class="secnum">1</span> Terms</a><ol class="toc"><li><a href="#proposal-terms-decorator"><span class="secnum">1.1</span> Decorator</a></li><li><a href="#proposal-terms-classdecoratorfunction"><span class="secnum">1.2</span> Class Decorator Function</a></li><li><a href="#proposal-terms-propertydecoratorfunction"><span class="secnum">1.3</span> Property/Method Decorator Function</a></li><li><a href="#proposal-terms-decoratorfactory"><span class="secnum">1.4</span> Decorator Factory</a></li></ol></li><li><a href="#proposal-decoratortargets"><span class="secnum">2</span> Decorator Targets</a></li><li><a href="#proposal-decoratoreval"><span class="secnum">3</span> Decorator Evaluation and Application Order</a></li><li><a href="#operations"><span class="secnum">4</span> Abstract Operations</a><ol class="toc"><li><a href="#operations-decoration"><span class="secnum">4.1</span> Decorator Operations</a><ol class="toc"><li><a href="#operations-decoration-decorate"><span class="secnum">4.1.1</span> Decorate ( Decorators, O, P, desc )</a></li><li><a href="#operations-decoration-decorateconstructor"><span class="secnum">4.1.2</span> DecorateConstructor ( Decorators, F )</a></li><li><a href="#operations-decoration-decorateproperty"><span class="secnum">4.1.3</span> DecorateProperty ( Decorators, O, P, desc )</a></li></ol></li><li><a href="#operations-object"><span class="secnum">4.2</span> Operations on Objects</a><ol class="toc"><li><a href="#createlistfromiterator"><span class="secnum">4.2.1</span> CreateListFromIterator ( iterator [, elementTypes] )</a></li><li><a href="#getorcreatemetadatamap"><span class="secnum">4.2.2</span> GetOrCreateMetadataMap ( O, P, Create )</a></li><li><a href="#hasmetadata"><span class="secnum">4.2.3</span> [[HasMetadata]] ( MetadataKey, P )</a></li><li><a href="#ordinaryhasmetadata"><span class="secnum">4.2.4</span> OrdinaryHasMetadata ( MetadataKey, O, P )</a></li><li><a href="#hasownmetadata"><span class="secnum">4.2.5</span> [[HasOwnMetadata]] ( MetadataKey, P )</a></li><li><a href="#ordinaryhasownmetadata"><span class="secnum">4.2.6</span> OrdinaryHasOwnMetadata ( MetadataKey, O, P )</a></li><li><a href="#getmetadata"><span class="secnum">4.2.7</span> [[GetMetadata]] ( MetadataKey, P )</a></li><li><a href="#ordinarygetmetadata"><span class="secnum">4.2.8</span> OrdinaryGetMetadata ( MetadataKey, O, P )</a></li><li><a href="#getownmetadata"><span class="secnum">4.2.9</span> [[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )</a></li><li><a href="#ordinarygetownmetadata"><span class="secnum">4.2.10</span> OrdinaryGetOwnMetadata ( MetadataKey, O, P )</a></li><li><a href="#defineownmetadata"><span class="secnum">4.2.11</span> [[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )</a></li><li><a href="#ordinarydefineownmetadata"><span class="secnum">4.2.12</span> OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )</a></li><li><a href="#metadatakeys"><span class="secnum">4.2.13</span> [[MetadataKeys]] ( P )</a></li><li><a href="#ordinarymetadatakeys"><span class="secnum">4.2.14</span> OrdinaryMetadataKeys ( O, P )</a></li><li><a href="#ownmetadatakeys"><span class="secnum">4.2.15</span> [[OwnMetadataKeys]] ( P )</a></li><li><a href="#ordinaryownmetadatakeys"><span class="secnum">4.2.16</span> OrdinaryOwnMetadataKeys ( O, P )</a></li><li><a href="#deletemetadata"><span class="secnum">4.2.17</span> [[DeleteMetadata]]( MetadataKey, P )</a></li></ol></li></ol></li><li><a href="#reflection"><span class="secnum">5</span> Reflection</a><ol class="toc"><li><a href="#reflect"><span class="secnum">5.1</span> The Reflect Object</a><ol class="toc"><li><a href="#reflect-metadatadecoratorfunctions"><span class="secnum">5.1.1</span> Metadata Decorator Functions</a></li><li><a href="#reflect-decorate"><span class="secnum">5.1.2</span> Reflect.decorate ( decorators, target, propertyKey, attributes )</a></li><li><a href="#reflect-metadata"><span class="secnum">5.1.3</span> Reflect.metadata ( metadataKey, metadataValue )</a></li><li><a href="#reflect-definemetadata"><span class="secnum">5.1.4</span> Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )</a></li><li><a href="#reflect-hasmetadata"><span class="secnum">5.1.5</span> Reflect.hasMetadata ( metadataKey, target, propertyKey )</a></li><li><a href="#reflect-hasownmetadata"><span class="secnum">5.1.6</span> Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )</a></li><li><a href="#reflect-getmetadata"><span class="secnum">5.1.7</span> Reflect.getMetadata ( metadataKey, target, propertyKey )</a></li><li><a href="#reflect-getownmetadata"><span class="secnum">5.1.8</span> Reflect.getOwnMetadata ( metadataKey, target, propertyKey )</a></li><li><a href="#reflect-getmetadatakeys"><span class="secnum">5.1.9</span> Reflect.getMetadataKeys ( target, propertyKey )</a></li><li><a href="#reflect-getownmetadata"><span class="secnum">5.1.10</span> Reflect.getOwnMetadataKeys ( target, propertyKey )</a></li><li><a href="#reflect-deletemetadata"><span class="secnum">5.1.11</span> Reflect.deleteMetadata ( metadataKey, target, propertyKey )</a></li></ol></li></ol></li><li><a href="#grammar"><span class="secnum">A</span> Grammar</a><ol class="toc"><li><a href="#grammar-expressions"><span class="secnum">A.1</span> Expressions</a></li><li><a href="#functions-and-classes"><span class="secnum">A.2</span> Functions and Classes</a></li><li><a href="#scripts-and-modules"><span class="secnum">A.3</span> Scripts and Modules</a></li></ol></li></ol></div><emu-intro id="introduction">
|
|
<h1><span class="secnum"></span>Introduction</h1>
|
|
<p>Proposal to add Decorators to ECMAScript.</p>
|
|
<p>For the TypeScript specific proposal, see <a href="typescript.html">http://rbuckton.github.io/reflectdecorators/typescript.html</a></p>
|
|
</emu-intro>
|
|
|
|
<emu-clause id="proposal-terms">
|
|
<h1><span class="secnum">1</span>Terms</h1>
|
|
<emu-clause id="proposal-terms-decorator">
|
|
<h1><span class="secnum">1.1</span>Decorator</h1>
|
|
<emu-note><span class="note">Note</span>This section is non-normative.</emu-note>
|
|
<p>A <em>decorator</em> is an expression that is evaluated after a class has been defined, that can be used to annotate or modify the class in some fashion. This expression must evaluate to a <code>function</code>, which is executed by the runtime to apply the decoration.</p>
|
|
<pre><code class="javascript hljs">@decoratorExpression
|
|
<span class="hljs-keyword">class</span> C {
|
|
}
|
|
</code></pre>
|
|
</emu-clause>
|
|
<emu-clause id="proposal-terms-classdecoratorfunction">
|
|
<h1><span class="secnum">1.2</span>Class Decorator Function</h1>
|
|
<emu-note><span class="note">Note</span>This section is non-normative.</emu-note>
|
|
<p>A <em>class decorator function</em> is a function that accepts a constructor function as its argument, and returns either <code>undefined</code>, the provided constructor function, or a new constructor function. Returning <code>undefined</code> is equivalent to returning the provided constructor function.</p>
|
|
<pre><code class="javascript hljs"><span class="hljs-comment">// A class decorator function</span>
|
|
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">dec</span><span class="hljs-params">(target)</span> </span>{
|
|
<span class="hljs-comment">// modify, annotate, or replace target...</span>
|
|
}
|
|
</code></pre>
|
|
</emu-clause>
|
|
<emu-clause id="proposal-terms-propertydecoratorfunction">
|
|
<h1><span class="secnum">1.3</span>Property/Method Decorator Function</h1>
|
|
<emu-note><span class="note">Note</span>This section is non-normative.</emu-note>
|
|
<p>A <em>property decorator function</em> is a function that accepts three arguments: The object that owns the property, the key for the property (a <code>string</code> or a <code>symbol</code>), and optionally the property descriptor of the property. The function must return either <code>undefined</code>, the provided property descriptor, or a new property descriptor. Returning <code>undefined</code> is equivalent to returning the provided property descriptor.</p>
|
|
<pre><code class="javascript hljs"><span class="hljs-comment">// A property (or method/accessor) decorator function</span>
|
|
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">dec</span><span class="hljs-params">(target, key, descriptor)</span> </span>{
|
|
<span class="hljs-comment">// annotate the target and key; or modify or replace the descriptor...</span>
|
|
}
|
|
</code></pre>
|
|
</emu-clause>
|
|
<emu-clause id="proposal-terms-decoratorfactory">
|
|
<h1><span class="secnum">1.4</span>Decorator Factory</h1>
|
|
<emu-note><span class="note">Note</span>This section is non-normative.</emu-note>
|
|
<p>A <em>decorator factory</em> is a function that can accept any number of arguments, and must return one of the above types of decorator function.</p>
|
|
<pre><code class="javascript hljs"><span class="hljs-comment">// a class decorator factory function</span>
|
|
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">dec</span><span class="hljs-params">(x, y)</span> </span>{
|
|
<span class="hljs-comment">// the class decorator function</span>
|
|
<span class="hljs-keyword">return</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(target)</span> </span>{
|
|
<span class="hljs-comment">// modify, annotate, or replace target...</span>
|
|
}
|
|
}
|
|
</code></pre>
|
|
</emu-clause>
|
|
</emu-clause>
|
|
<emu-clause id="proposal-decoratortargets">
|
|
<h1><span class="secnum">2</span>Decorator Targets</h1>
|
|
<emu-note><span class="note">Note</span>This section is non-normative.</emu-note>
|
|
<p>A <em>decorator</em> <strong>can</strong> be legally applied to any of the following:</p>
|
|
<ul>
|
|
<li>A class declaration</li>
|
|
<li>A class property initializer (static or prototype)</li>
|
|
<li>A class method declaration (static or prototype)</li>
|
|
<li>A class get or set accessor declaration (static or prototype)</li>
|
|
</ul>
|
|
<p>Please note that a <em>decorator</em> currently <strong>cannot</strong> be legally applied to any of the following:</p>
|
|
<ul>
|
|
<li>A class constructor - This is to reduce ambiguity between where you can apply a decorator (on the class or on its constructor) and which of the above decorator function forms is called.</li>
|
|
<li>A function declaration - Decorators on a function declaration would introduce a TDZ (Temporal Dead Zone), which would make the function unreachable until its declaration is executed. This could cause confusion as an undecorated function declaration is hoisted and can be used in a statement preceeding the declaration.</li>
|
|
<li>A function expression - This is to reduce confusion and maintain parity with disallowing decorators on a function declaration.</li>
|
|
<li>An arrow function - This is to reduce confusion and maintain parity with disallowing decorators on a function expression.</li>
|
|
</ul>
|
|
<p>This list may change in the future.</p>
|
|
</emu-clause>
|
|
<emu-clause id="proposal-decoratoreval">
|
|
<h1><span class="secnum">3</span>Decorator Evaluation and Application Order</h1>
|
|
<emu-note><span class="note">Note</span>This section is non-normative.</emu-note>
|
|
<p>Decorators are <em>evaluated</em> in the order they appear preceeding their target declaration, to preserve side-effects due to evaluation order. Decorators are <em>applied</em> to their target declaration in reverse order, starting with the decorator closest to the declaration. This behavior is specified to preserve the expected behavior of decorators without a declarative syntax.</p>
|
|
<pre><code class="javascript hljs">@F
|
|
@G
|
|
<span class="hljs-keyword">class</span> C {
|
|
}
|
|
</code></pre>
|
|
<p>For example, the above listing could be approximately written without decorators in the following fashion:</p>
|
|
<pre><code class="javascript hljs">C = F(G(C))</code></pre>
|
|
<p>In the above example, the expression <code>F</code> is evaluated first, followed by the expression <code>G</code>. <code>G</code> is then called with the constructor function as its argument, followed by calling <code>F</code> with the result. The actual process of applying decorators is more complex than the above example however, though you may still imperatively apply decorators with a reflection API.</p>
|
|
<p>If a class declaration has decorators on both the class and any of its members or parameters, the decorators are applied using the following pseudocode:</p>
|
|
<pre>for each member M of class C
|
|
if M is an accessor then
|
|
let accessor = first accessor (get or set, in declaration order) of M
|
|
let memberDecorators = decorators of accessor
|
|
for each parameter of accessor
|
|
let paramDecorators = decorators of parameter
|
|
let paramIndex = ordinal index of parameter
|
|
Reflect.decorate(paramDecorators, accessor, paramIndex)
|
|
next parameter
|
|
|
|
let accessor = second accessor (get or set, in declaration order) of M
|
|
if accessor then
|
|
let memberDecorators = memberDecorators + decorators of accessor
|
|
for each parameter of accessor
|
|
let paramDecorators = decorators of parameter
|
|
let paramIndex = ordinal index of parameter
|
|
Reflect.decorate(paramDecorators, accessor, paramIndex)
|
|
next parameter
|
|
end if
|
|
else if M is a method
|
|
let memberDecorators = decorators of M
|
|
for each parameter of M
|
|
let paramDecorators = decorators of parameter
|
|
let paramIndex = ordinal index of parameter
|
|
Reflect.decorate(paramDecorators, M, paramIndex)
|
|
next parameter
|
|
else
|
|
let memberDecorators = decorators of M
|
|
end if
|
|
|
|
let name = name of M
|
|
let target = C.prototype if M is on the prototype; otherwise, C if M is static
|
|
Reflect.decorate(memberDecorators, C, name)
|
|
next member
|
|
|
|
for each parameter of C
|
|
let paramDecorators = decorators of parameter
|
|
let paramIndex = ordinal index of parameter
|
|
Reflect.decorate(paramDecorators, C, paramIndex)
|
|
next parameter
|
|
|
|
let classDecorators = decorators of C
|
|
let C = Reflect.decorate(classDecorators, C)
|
|
</pre>
|
|
</emu-clause>
|
|
|
|
<emu-clause id="operations">
|
|
<h1><span class="secnum">4</span>Abstract Operations</h1>
|
|
<emu-clause id="operations-decoration">
|
|
<h1><span class="secnum">4.1</span>Decorator Operations</h1>
|
|
<emu-clause id="operations-decoration-decorate">
|
|
<h1><span class="secnum">4.1.1</span>Decorate ( Decorators, O, P, desc )</h1>
|
|
<p>When the abstract operation Decorate is called with ECMAScript language value <var>Decorators</var>, Object <var>O</var>, property key <var>P</var>, and property descriptor <var>desc</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="Decorate" id="ao-Decorate"><ol>
|
|
<li>If <var>P</var> is <emu-val>undefined</emu-val> and <var>desc</var> is <emu-val>undefined</emu-val>, then
|
|
<ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<var>O</var>) is not <emu-val>true</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>Return <a href="#ao-DecorateConstructor">DecorateConstructor</a>(<var>Decorators</var>, <var>O</var>).</li>
|
|
</ol>
|
|
</li>
|
|
<li>Else
|
|
<ol>
|
|
<li>Return <a href="#ao-DecorateProperty">DecorateProperty</a>(<var>Decorators</var>, <var>O</var>, <var>P</var>, <var>desc</var>).</li>
|
|
</ol>
|
|
</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="operations-decoration-decorateconstructor">
|
|
<h1><span class="secnum">4.1.2</span>DecorateConstructor ( Decorators, F )</h1>
|
|
<p>When the abstract operation DecorateConstructor is called with ECMAScript language value <var>Decorators</var> and Object <var>F</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="DecorateConstructor" id="ao-DecorateConstructor"><ol>
|
|
<li>Let <var>result</var> be <var>F</var>.</li>
|
|
<li>Let <var>iterator</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<var>Decorators</var>). </li>
|
|
<li>Let <var>list</var> be <a href="#ao-CreateListFromIterator">CreateListFromIterator</a>(<var>iterator</var>, «Object»).</li>
|
|
<li>For each <var>decorator</var> in <var>list</var> in reverse order
|
|
<ol>
|
|
<li>Let <var>decorated</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call-f-v-args">Call</a>(<var>decorator</var>, <emu-val>null</emu-val>, <var>result</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>decorated</var>).</li>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable">IsCallable</a>(<var>decorated</var>), then
|
|
<ol>
|
|
<li>Set <var>result</var> to be <var>decorated</var>.</li>
|
|
</ol>
|
|
</li>
|
|
<li>Else if <var>decorated</var> is not <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
</ol>
|
|
</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="operations-decoration-decorateproperty">
|
|
<h1><span class="secnum">4.1.3</span>DecorateProperty ( Decorators, O, P, desc )</h1>
|
|
<p>When the abstract operation DecorateProperty is called with ECMAScript language value <var>Decorators</var>, Object <var>O</var>, property key <var>P</var>, and property descriptor <var>desc</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="DecorateProperty" id="ao-DecorateProperty"><ol>
|
|
<li>Let <var>result</var> be <var>desc</var>.</li>
|
|
<li>Let <var>key</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<var>P</var>).</li>
|
|
<li>Let <var>iterator</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<var>Decorators</var>). </li>
|
|
<li>Let <var>list</var> be <a href="#ao-CreateListFromIterator">CreateListFromIterator</a>(<var>iterator</var>, «Object»).</li>
|
|
<li>For each <var>decorator</var> in <var>list</var> in reverse order
|
|
<ol start="6">
|
|
<li>Let <var>decorated</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call-f-v-args">Call</a>(<var>decorator</var>, <emu-val>null</emu-val>, <var>O</var>, <var>key</var>, <var>result</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>decorated</var>).</li>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>decorated</var>) is Object, then
|
|
<ol>
|
|
<li>Set <var>result</var> to be <var>decorated</var>.</li>
|
|
</ol>
|
|
</li>
|
|
<li>Else if <var>decorated</var> is not <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
</ol>
|
|
</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
</emu-clause>
|
|
<emu-clause id="operations-object">
|
|
<h1><span class="secnum">4.2</span>Operations on Objects</h1>
|
|
<emu-clause id="createlistfromiterator">
|
|
<h1><span class="secnum">4.2.1</span>CreateListFromIterator ( iterator [, elementTypes] )</h1>
|
|
<p>When the abstract operation CreateListFromIterator is called with ECMAScript language value <var>iterator</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="CreateListFromIterator" id="ao-CreateListFromIterator"><ol>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>iterator</var>).</li>
|
|
<li>If <var>elementTypes</var> was not passed, let <var>elementTypes</var> be (Undefined, Null, Boolean, String, Symbol, Number, Object).</li>
|
|
<li>Let <var>list</var> be an empty List.</li>
|
|
<li>Repeat
|
|
<ol>
|
|
<li>Let <var>next</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<var>iterator</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>next</var>).</li>
|
|
<li>If <var>next</var> is <emu-val>false</emu-val>, return <var>list</var>.</li>
|
|
<li>Let <var>nextValue</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<var>next</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>nextValue</var>).</li>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>nextValue</var>) is not an element of <var>elementTypes</var>, then
|
|
<ol>
|
|
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorclose">IteratorClose</a>(<var>iterator</var>, Completion{[[type]]: throw, [[value]]: a newly created <emu-val>TypeError</emu-val> object, [[target]: empty}).</li>
|
|
</ol>
|
|
</li>
|
|
<li>Append <var>nextValue</var> as the last element of <var>list</var>.</li>
|
|
</ol>
|
|
</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="getorcreatemetadatamap">
|
|
<h1><span class="secnum">4.2.2</span>GetOrCreateMetadataMap ( O, P, Create )</h1>
|
|
<p>When the abstract operation GetOrCreateMetadataMap is called with Object <var>O</var>, property key <var>P</var>, and Boolean <var>Create</var> the following steps are taken:</p>
|
|
<emu-alg aoid="GetOrCreateMetadataMap" id="ao-GetOrCreateMetadataMap"><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>metadataMap</var> be <emu-val>undefined</emu-val>.</li>
|
|
<li>Let <var>succeeded</var> be <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>targetMetadata</var> be the value of <var>O</var>'s [[Metadata]] internal slot.</li>
|
|
<li>If <var>targetMetadata</var> is <emu-val>undefined</emu-val>, then
|
|
<ol>
|
|
<li>If <var>Create</var> is <emu-val>false</emu-val>, return <emu-val>undefined</emu-val>.</li>
|
|
<li>Set <var>targetMetadata</var> to be a newly created <emu-val>Map</emu-val> object.</li>
|
|
<li>Set the [[Metadata]] internal slot of <var>O</var> to <var>targetMetadata</var>.</li>
|
|
</ol>
|
|
</li>
|
|
<li>Let <var>metadataMap</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>targetMetadata</var>, <code>"get"</code>, <var>P</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>metadataMap</var>).</li>
|
|
<li>If <var>metadataMap</var> is <emu-val>undefined</emu-val>, then
|
|
<ol>
|
|
<li>If <var>Create</var> is <emu-val>false</emu-val>, return <emu-val>undefined</emu-val>.</li>
|
|
<li>Set <var>metadataMap</var> to be a newly created <emu-val>Map</emu-val> object.</li>
|
|
<li>Let <var>setStatus</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>targetMetadata</var>, <code>"set"</code>, <var>P</var>, <var>metadataMap</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>setStatus</var>).</li>
|
|
</ol>
|
|
</li>
|
|
<li>Return <var>metadataMap</var>.</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="hasmetadata">
|
|
<h1><span class="secnum">4.2.3</span>[[HasMetadata]] ( MetadataKey, P )</h1>
|
|
<p>When the [[HasMetadata]] internal method of <var>O</var> is called with ECMAScript language value <var>MetadataKey</var> and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Return <a href="#ao-OrdinaryHasMetadata">OrdinaryHasMetadata</a>(<var>MetadataKey</var>, <var>O</var>, <var>P</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="ordinaryhasmetadata">
|
|
<h1><span class="secnum">4.2.4</span>OrdinaryHasMetadata ( MetadataKey, O, P )</h1>
|
|
<p>When the abstract operation OrdinaryHasMetadata is called with ECMAScript language value <var>MetadataKey</var>, Object <var>O</var>, and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="OrdinaryHasMetadata" id="ao-OrdinaryHasMetadata"><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>hasOwn</var> be <a href="#ao-OrdinaryHasOwnMetadata">OrdinaryHasOwnMetadata</a>(<var>MetadataKey</var>, <var>O</var>, <var>P</var>).</li>
|
|
<li>If <var>hasOwn</var> is <emu-val>true</emu-val>, return <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>parent</var> be <var>O</var>.[[GetPrototypeOf]]().</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>parent</var>).</li>
|
|
<li>If <var>parent</var> is not <emu-val>null</emu-val>, then
|
|
<ol>
|
|
<li>return <var>parent</var>.[[HasMetadata]](<var>MetadataKey</var>, <var>P</var>).</li>
|
|
</ol>
|
|
</li>
|
|
<li>Return <emu-val>false</emu-val>.</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="hasownmetadata">
|
|
<h1><span class="secnum">4.2.5</span>[[HasOwnMetadata]] ( MetadataKey, P )</h1>
|
|
<p>When the [[HasOwnMetadata]] internal method of <var>O</var> is called with ECMAScript language value <var>MetadataKey</var> and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Return <a href="#ao-OrdinaryHasOwnMetadata">OrdinaryHasOwnMetadata</a>(<var>MetadataKey</var>, <var>O</var>, <var>P</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="ordinaryhasownmetadata">
|
|
<h1><span class="secnum">4.2.6</span>OrdinaryHasOwnMetadata ( MetadataKey, O, P )</h1>
|
|
<p>When the abstract operation OrdinaryHasOwnMetadata is called with ECMAScript language value <var>MetadataKey</var>, Object <var>O</var>, and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="OrdinaryHasOwnMetadata" id="ao-OrdinaryHasOwnMetadata"><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>metadataMap</var> be <a href="#ao-GetOrCreateMetadataMap">GetOrCreateMetadataMap</a>(<var>O</var>, <var>P</var>, <emu-val>false</emu-val>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>metadataMap</var>).</li>
|
|
<li>If <var>metadataMap</var> is <emu-val>undefined</emu-val>, return <emu-val>false</emu-val>.</li>
|
|
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>metadataMap</var>, <code>"has"</code>, <var>MetadataKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="getmetadata">
|
|
<h1><span class="secnum">4.2.7</span>[[GetMetadata]] ( MetadataKey, P )</h1>
|
|
<p>When the [[GetMatadata]] internal method of <var>O</var> is called with ECMAScript language value <var>MetadataKey</var> and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Return <a href="#ao-OrdinaryGetMetadata">OrdinaryGetMetadata</a>(<var>MetadataKey</var>, <var>O</var>, <var>P</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="ordinarygetmetadata">
|
|
<h1><span class="secnum">4.2.8</span>OrdinaryGetMetadata ( MetadataKey, O, P )</h1>
|
|
<p>When the abstract operation OrdinaryGetMetadata is called with ECMAScript language value <var>MetadataKey</var>, Object <var>O</var>, and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="OrdinaryGetMetadata" id="ao-OrdinaryGetMetadata"><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>hasOwn</var> be <a href="#ao-OrdinaryHasOwnMetadata">OrdinaryHasOwnMetadata</a>(<var>MetadataKey</var>, <var>O</var>, <var>P</var>).</li>
|
|
<li>If <var>hasOwn</var> is <emu-val>true</emu-val>, then
|
|
<ol>
|
|
<li>return <a href="#ao-OrdinaryGetOwnMetadata">OrdinaryGetOwnMetadata</a>(<var>MetadataKey</var>, <var>O</var>, <var>P</var>).</li>
|
|
</ol>
|
|
</li>
|
|
<li>Let <var>parent</var> be <var>O</var>.[[GetPrototypeOf]]().</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>parent</var>).</li>
|
|
<li>If <var>parent</var> is not <emu-val>null</emu-val>, then
|
|
<ol>
|
|
<li>return <var>parent</var>.[[GetMetadata]](<var>MetadataKey</var>, <var>P</var>).</li>
|
|
</ol>
|
|
</li>
|
|
<li>Return <emu-val>undefined</emu-val>.</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="getownmetadata">
|
|
<h1><span class="secnum">4.2.9</span>[[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )</h1>
|
|
<p>When the [[GetOwnMetadata]] internal method of <var>O</var> is called with ECMAScript language value <var>MetadataKey</var> and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Return <a href="#ao-OrdinaryGetOwnMetadata">OrdinaryGetOwnMetadata</a>(<var>MetadataKey</var>, <var>O</var>, <var>P</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="ordinarygetownmetadata">
|
|
<h1><span class="secnum">4.2.10</span>OrdinaryGetOwnMetadata ( MetadataKey, O, P )</h1>
|
|
<p>When the abstract operation OrdinaryGetOwnMetadata is called with ECMAScript language value <var>MetadataKey</var>, Object <var>O</var>, and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="OrdinaryGetOwnMetadata" id="ao-OrdinaryGetOwnMetadata"><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>metadataMap</var> be <a href="#ao-GetOrCreateMetadataMap">GetOrCreateMetadataMap</a>(<var>O</var>, <var>P</var>, <emu-val>false</emu-val>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>metadataMap</var>).</li>
|
|
<li>If <var>metadataMap</var> is <emu-val>undefined</emu-val>, return <emu-val>undefined</emu-val>.</li>
|
|
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>metadataMap</var>, <code>"get"</code>, <var>MetadataKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="defineownmetadata">
|
|
<h1><span class="secnum">4.2.11</span>[[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )</h1>
|
|
<p>When the [[DefineOwnMetadata]] internal method of <var>O</var> is called with ECMAScript language value <var>MetadataKey</var>, ECMAScript language value <var>MetadataValue</var>, and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Return <a href="#ao-OrdinaryDefineOwnMetadata">OrdinaryDefineOwnMetadata</a>(<var>MetadataKey</var>, <var>MetadataValue</var>, <var>O</var>, <var>P</var>)</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="ordinarydefineownmetadata">
|
|
<h1><span class="secnum">4.2.12</span>OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )</h1>
|
|
<p>When the abstract operation OrdinaryDefineOwnProperty is called with ECMAScript language value <var>MetadataKey</var>, ECMAScript language value <var>MetadataValue</var>, Object <var>O</var>, and property key <var>P</var>, the following steps are taken:</p>
|
|
<emu-alg aoid="OrdinaryDefineOwnMetadata" id="ao-OrdinaryDefineOwnMetadata"><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>metadataMap</var> be <a href="#ao-GetOrCreateMetadataMap">GetOrCreateMetadataMap</a>(<var>O</var>, <var>P</var>, <emu-val>true</emu-val>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>metadataMap</var>).</li>
|
|
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>metadataMap</var>, <code>"set"</code>, <var>MetadataKey</var>, <var>MetadataValue</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="metadatakeys">
|
|
<h1><span class="secnum">4.2.13</span>[[MetadataKeys]] ( P )</h1>
|
|
<p>When the [[MetadataKeys]] internal method of <var>O</var> is called with property key <var>P</var> the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Return <a href="#ao-OrdinaryMetadataKeys">OrdinaryMetadataKeys</a>(<var>O</var>, <var>P</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="ordinarymetadatakeys">
|
|
<h1><span class="secnum">4.2.14</span>OrdinaryMetadataKeys ( O, P )</h1>
|
|
<p>When the abstract operation OrdinaryMetadataKeys is called with Object <var>O</var> and property key <var>P</var> the following steps are taken:</p>
|
|
<emu-alg aoid="OrdinaryMetadataKeys" id="ao-OrdinaryMetadataKeys"><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>ownKeys</var> be <a href="#ao-OrdinaryOwnMetadataKeys">OrdinaryOwnMetadataKeys</a>(<var>O</var>, <var>P</var>).</li>
|
|
<li>Let <var>parent</var> = <var>O</var>.[[GetPrototypeOf]]().</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>parent</var>).</li>
|
|
<li>If <var>parent</var> is <emu-val>null</emu-val>, then return <var>ownKeys</var>.</li>
|
|
<li>Let <var>parentKeys</var> be <var>O</var>.[[OrdinaryMetadataKeys]](<var>P</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>parentKeys</var>).</li>
|
|
<li>Let <var>ownKeysLen</var> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<var>ownKeys</var>, <code>"length"</code>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>ownKeysLen</var>).</li>
|
|
<li>If <var>ownKeysLen</var> is 0, return <var>parentKeys</var>.</li>
|
|
<li>Let <var>parentKeysLen</var> = <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-o-p">Get</a>(<var>parentKeys</var>, <code>"length"</code>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>parentKeysLen</var>).</li>
|
|
<li>If <var>parentKeysLen</var> is 0, return <var>ownKeys</var>.</li>
|
|
<li>Let <var>set</var> be a newly created <emu-val>Set</emu-val> object.</li>
|
|
<li>Let <var>keys</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
|
|
<li>Let <var>k</var> be 0.</li>
|
|
<li>For each element <var>key</var> of <var>ownKeys</var>
|
|
<ol>
|
|
<li>Let <var>hasKey</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>set</var>, <code>"has"</code>, <var>key</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>hasKey</var>).</li>
|
|
<li>If <var>hasKey</var> is <emu-val>false</emu-val>, then
|
|
<ol>
|
|
<li>Let <var>Pk</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<var>k</var>).</li>
|
|
<li>Let <var>addStatus</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>set</var>, <code>"add"</code>, <var>key</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>addStatus</var>).</li>
|
|
<li>Let <var>defineStatus</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<var>keys</var>, <var>Pk</var>, <var>key</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>defineStatus</var>).</li>
|
|
<li>Increase <var>k</var> by 1.</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>For each element <var>key</var> of <var>parentKeys</var>
|
|
<ol>
|
|
<li>Let <var>hasKey</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>set</var>, <code>"has"</code>, <var>key</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>hasKey</var>).</li>
|
|
<li>If <var>hasKey</var> is <emu-val>false</emu-val>, then
|
|
<ol>
|
|
<li>Let <var>Pk</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(<var>k</var>).</li>
|
|
<li>Let <var>addStatus</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>set</var>, <code>"add"</code>, <var>key</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>addStatus</var>).</li>
|
|
<li>Let <var>defineStatus</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<var>keys</var>, <var>Pk</var>, <var>key</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>defineStatus</var>).</li>
|
|
<li>Increase <var>k</var> by 1.</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>Let <var>setStatus</var> be Set(<var>keys</var>, <code>"length"</code>, <var>k</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>setStatus</var>).</li>
|
|
<li>return <var>keys</var>.</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="ownmetadatakeys">
|
|
<h1><span class="secnum">4.2.15</span>[[OwnMetadataKeys]] ( P )</h1>
|
|
<p>When the [[OwnMetadataKeys]] internal method of <var>O</var> is called with property key <var>P</var> the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Return <a href="#ao-OrdinaryOwnMetadataKeys">OrdinaryOwnMetadataKeys</a>(<var>O</var>, <var>P</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="ordinaryownmetadatakeys">
|
|
<h1><span class="secnum">4.2.16</span>OrdinaryOwnMetadataKeys ( O, P )</h1>
|
|
<p>When the abstract operation OrdinaryOwnMetadataKeys is called with Object <var>O</var> and property key <var>P</var> the following steps are taken:</p>
|
|
<emu-alg aoid="OrdinaryOwnMetadataKeys" id="ao-OrdinaryOwnMetadataKeys"><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>keys</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-arraycreate">ArrayCreate</a>(0).</li>
|
|
<li>Let <var>metadataMap</var> be <a href="#ao-GetOrCreateMetadataMap">GetOrCreateMetadataMap</a>(<var>O</var>, <var>P</var>, <emu-val>false</emu-val>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>metadataMap</var>).</li>
|
|
<li>If <var>metadataMap</var> is <emu-val>undefined</emu-val>, return <var>keys</var>.</li>
|
|
<li>Let <var>keysObj</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>metadataMap</var>, <code>"keys"</code>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>keysObj</var>).</li>
|
|
<li>Let <var>iterator</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator">GetIterator</a>(<var>keysObj</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>iterator</var>).</li>
|
|
<li>Let <var>k</var> be 0.</li>
|
|
<li>Repeat
|
|
<ol>
|
|
<li>Let <var>Pk</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring">ToString</a>(k).</li>
|
|
<li>Let <var>next</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorstep">IteratorStep</a>(<var>iterator</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>next</var>).</li>
|
|
<li>If <var>next</var> is <emu-val>false</emu-val>, then
|
|
<ol>
|
|
<li>Let <var>setStatus</var> be Set(<var>keys</var>, <code>"length"</code>, <var>k</var>, <var>true</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>setStatus</var>).</li>
|
|
<li>Return <var>keys</var>.</li>
|
|
</ol>
|
|
</li>
|
|
<li>Let <var>nextValue</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorvalue">IteratorValue</a>(<var>next</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>nextValue</var>).</li>
|
|
<li>Let <var>defineStatus</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a>(<var>keys</var>, <var>Pk</var>, <var>nextValue</var>).</li>
|
|
<li>If <var>defineStatus</var> is an abrupt completion, return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratorclose">IteratorClose</a>(<var>iterator</var>, <var>defineStatus</var>).</li>
|
|
<li>Increase <var>k</var> by 1.</li>
|
|
</ol>
|
|
</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="deletemetadata">
|
|
<h1><span class="secnum">4.2.17</span>[[DeleteMetadata]]( MetadataKey, P )</h1>
|
|
<p>When the [[DeleteMetadata]] internal method of <var>O</var> is called with ECMAScript language value <var>MetadataKey</var> and property key <var>P</var> the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Assert: <var>P</var> is <emu-val>undefined</emu-val> or <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>P</var>) is <emu-val>true</emu-val>.</li>
|
|
<li>Let <var>metadataMap</var> be <a href="#ao-GetOrCreateMetadataMap">GetOrCreateMetadataMap</a>(<var>O</var>, <var>P</var>, <emu-val>false</emu-val>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>metadataMap</var>).</li>
|
|
<li>If <var>metadataMap</var> is <emu-val>undefined</emu-val>, return <emu-val>false</emu-val>.</li>
|
|
<li>Return <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-invoke">Invoke</a>(<var>metadataMap</var>, <code>"delete"</code>, <var>MetadataKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
</emu-clause>
|
|
</emu-clause>
|
|
|
|
<emu-clause id="reflection">
|
|
<h1><span class="secnum">5</span>Reflection</h1>
|
|
<emu-clause id="reflect">
|
|
<h1><span class="secnum">5.1</span>The Reflect Object</h1>
|
|
<p>This section contains amendments to the Reflect object.</p>
|
|
<emu-note><span class="note">Note</span>A shim for this API can be found here: <a href="https://github.com/rbuckton/ReflectDecorators">https://github.com/rbuckton/ReflectDecorators</a></emu-note>
|
|
<emu-clause id="reflect-metadatadecoratorfunctions">
|
|
<h1><span class="secnum">5.1.1</span>Metadata Decorator Functions</h1>
|
|
<p>A metadata decorator function is an anonymous built-in function that has [[MetadataKey]] and [[MetadataValue]] internal slots.</p>
|
|
<p>When a metadata decorator function <var>F</var> is called with arguments <var>target</var> and <var>key</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Assert: <var>F</var> has a [[MetadataKey]] internal slot whose value is an ECMAScript language value, or <emu-val>undefined</emu-val>.</li>
|
|
<li>Assert: <var>F</var> has a [[MetadataValue]] internal slot whose value is an ECMAScript language value, or <emu-val>undefined</emu-val>.</li>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>If <var>key</var> is not <emu-val>undefined</emu-val> and <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey">IsPropertyKey</a>(<var>key</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>Let <var>metadataKey</var> be the value of <var>F</var>'s [[MetadataKey]] internal slot.</li>
|
|
<li>Let <var>metadataValue</var> be the value of <var>F</var>'s [[MetadataValue]] internal slot.</li>
|
|
<li>Return <var>target</var>.[[DefineMetadata]](<var>metadataKey</var>, <var>metadataValue</var>, <var>target</var>, <var>key</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-decorate">
|
|
<h1><span class="secnum">5.1.2</span>Reflect.decorate ( decorators, target, propertyKey, attributes )</h1>
|
|
<p>When the <code>decorator</code> function is called with arguments <var>decorators</var>, <var>target</var>, <var>propertyKey</var>, and <var>attributes</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>decorators</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>Let <var>key</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey">ToPropertyKey</a>(<var>propertyKey</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>propertyKey</var>).</li>
|
|
<li>Let <var>desc</var> be <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertydescriptor">ToPropertyDescriptor</a>(<var>attributes</var>).</li>
|
|
<li><a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-returnifabrupt">ReturnIfAbrupt</a>(<var>desc</var>).</li>
|
|
<li>Return <a href="#ao-Decorate">Decorate</a>(<var>decorators</var>, <var>target</var>, <var>propertyKey</var>, <var>desc</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-metadata">
|
|
<h1><span class="secnum">5.1.3</span>Reflect.metadata ( metadataKey, metadataValue )</h1>
|
|
<p>When the <code>metadata</code> function is called with arguments <var>metadataKey</var> and <var>metadataValue</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>Let <var>decorator</var> be a new built-in function object as defined in Metadata Decorator Functions.</li>
|
|
<li>Set the [[MetadataKey]] internal slot of <var>decorator</var> to <var>metadataKey</var>.</li>
|
|
<li>Set the [[MetadataValue]] internal slot of <var>decorator</var> to <var>metadataValue</var>.</li>
|
|
<li>return <var>decorator</var>.</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-definemetadata">
|
|
<h1><span class="secnum">5.1.4</span>Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )</h1>
|
|
<p>When the <code>defineMetadata</code> function is called with arguments <var>metadataKey</var>, <var>metadataValue</var>, <var>target</var>, and <var>propertyKey</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>return <var>target</var>.[[DefineMetadata]](<var>metadataKey</var>, <var>metadataValue</var>, <var>propertyKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-hasmetadata">
|
|
<h1><span class="secnum">5.1.5</span>Reflect.hasMetadata ( metadataKey, target, propertyKey )</h1>
|
|
<p>When the <code>hasMetadata</code> function is called with arguments <var>metadataKey</var>, <var>target</var>, and <var>propertyKey</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>return <var>target</var>.[[HasMetadata]](<var>metadataKey</var>, <var>propertyKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-hasownmetadata">
|
|
<h1><span class="secnum">5.1.6</span>Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )</h1>
|
|
<p>When the <code>hasOwnMetadata</code> function is called with arguments <var>metadataKey</var>, <var>target</var>, and <var>propertyKey</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>return <var>target</var>.[[HasOwn]](<var>metadataKey</var>, <var>propertyKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-getmetadata">
|
|
<h1><span class="secnum">5.1.7</span>Reflect.getMetadata ( metadataKey, target, propertyKey )</h1>
|
|
<p>When the <code>getMetadata</code> function is called with arguments <var>metadataKey</var>, <var>target</var>, and <var>propertyKey</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>return <var>target</var>.[[GetMetadata]](<var>metadataKey</var>, <var>propertyKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-getownmetadata">
|
|
<h1><span class="secnum">5.1.8</span>Reflect.getOwnMetadata ( metadataKey, target, propertyKey )</h1>
|
|
<p>When the <code>getOwnMetadata</code> function is called with arguments <var>metadataKey</var>, <var>target</var>, and <var>propertyKey</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>return <var>target</var>.[[GetOwnMetadata]](<var>metadataKey</var>, <var>propertyKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-getmetadatakeys">
|
|
<h1><span class="secnum">5.1.9</span>Reflect.getMetadataKeys ( target, propertyKey )</h1>
|
|
<p>When the <code>getMetadataKeys</code> function is called with arguments <var>target</var> and <var>propertyKey</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>return <var>target</var>.[[GetMetadataKeys]](<var>propertyKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-getownmetadata">
|
|
<h1><span class="secnum">5.1.10</span>Reflect.getOwnMetadataKeys ( target, propertyKey )</h1>
|
|
<p>When the <code>getOwnMetadataKeys</code> function is called with arguments <var>target</var> and <var>propertyKey</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>return <var>target</var>.[[GetOwnMetadataKeys]](<var>propertyKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
<emu-clause id="reflect-deletemetadata">
|
|
<h1><span class="secnum">5.1.11</span>Reflect.deleteMetadata ( metadataKey, target, propertyKey )</h1>
|
|
<p>When the <code>deleteMetadata</code> function is called with arguments <var>metadataKey</var>, <var>target</var>, and <var>propertyKey</var>, the following steps are taken:</p>
|
|
<emu-alg><ol>
|
|
<li>If <a href="https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values">Type</a>(<var>target</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li>
|
|
<li>return <var>target</var>.[[DeleteMetadata]](<var>metadataKey</var>, <var>propertyKey</var>).</li>
|
|
</ol></emu-alg>
|
|
</emu-clause>
|
|
</emu-clause>
|
|
</emu-clause>
|
|
<emu-annex id="grammar">
|
|
<h1><span class="secnum">A</span>Grammar</h1>
|
|
<emu-annex id="grammar-expressions">
|
|
<h1><span class="secnum">A.1</span>Expressions</h1>
|
|
<emu-production id="grammar-memberexpression" name="MemberExpression" params="Yield, Decorator">
|
|
<emu-nt>MemberExpression<emu-mods> [Yield, Decorator]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-nt params="?Yield">PrimaryExpression<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs constraints="~Decorator"><emu-constraints>[~Decorator]</emu-constraints><emu-nt params="?Yield, ?Decorator">MemberExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt><emu-t>[</emu-t><emu-nt params="In, ?Yield">Expression<emu-mods> [In, ?Yield]</emu-mods></emu-nt><emu-t>]</emu-t></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield, ?Decorator">MemberExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt><emu-t>.</emu-t><emu-nt>IdentifierName<emu-mods></emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield, ?Decorator">MemberExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt><emu-nt params="?Yield">TemplateLiteral<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield, ?Decorator">SuperProperty<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt>MetaProperty<emu-mods></emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-t>new</emu-t><emu-nt params="?Yield, ?Decorator">MemberExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt><emu-nt params="?Yield">Arguments<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
<emu-production id="grammar-superproperty" name="SuperProperty" params="Yield, Decorator">
|
|
<emu-nt>SuperProperty<emu-mods> [Yield, Decorator]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs constraints="~Decorator"><emu-constraints>[~Decorator]</emu-constraints><emu-t>super</emu-t><emu-t>[</emu-t><emu-nt params="In, ?Yield">Expression<emu-mods> [In, ?Yield]</emu-mods></emu-nt><emu-t>]</emu-t></emu-rhs>
|
|
</emu-production>
|
|
<emu-production id="grammar-newexpression" name="NewExpression" params="Yield, Decorator">
|
|
<emu-nt>NewExpression<emu-mods> [Yield, Decorator]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-nt params="?Yield, ?Decorator">MemberExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-t>new</emu-t><emu-nt params="?Yield, ?Decorator">NewExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
<emu-production id="grammar-callexpression" name="CallExpression" params="Yield, Decorator">
|
|
<emu-nt>CallExpression<emu-mods> [Yield, Decorator]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-nt params="?Yield, ?Decorator">MemberExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt><emu-nt params="?Yield">Arguments<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield">SuperCall<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield, ?Decorator">CallExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt><emu-nt params="?Yield">Arguments<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs constraints="~Decorator"><emu-constraints>[~Decorator]</emu-constraints><emu-nt params="?Yield">CallExpression<emu-mods> [?Yield]</emu-mods></emu-nt><emu-t>[</emu-t><emu-nt params="In, ?Yield">Expression<emu-mods> [In, ?Yield]</emu-mods></emu-nt><emu-t>]</emu-t></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield, ?Decorator">CallExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt><emu-t>.</emu-t><emu-nt>IdentifierName<emu-mods></emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield, ?Decorator">CallExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt><emu-nt params="?Yield">TemplateLiteral<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
<emu-production id="grammar-lefthandsideexpression" name="LeftHandSideExpression" params="Yield, Decorator">
|
|
<emu-nt>LeftHandSideExpression<emu-mods> [Yield, Decorator]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-nt params="?Yield, ?Decorator">NewExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield, ?Decorator">CallExpression<emu-mods> [?Yield, ?Decorator]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
</emu-annex>
|
|
|
|
<emu-annex id="functions-and-classes">
|
|
<h1><span class="secnum">A.2</span>Functions and Classes</h1>
|
|
<emu-production id="grammar-classdeclaration" name="ClassDeclaration" params="Yield, Default">
|
|
<emu-nt>ClassDeclaration<emu-mods> [Yield, Default]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-nt params="?Yield" optional="">DecoratorList<emu-mods> [?Yield] opt</emu-mods></emu-nt><emu-t>class</emu-t><emu-nt params="?Yield">BindingIdentifier<emu-mods> [?Yield]</emu-mods></emu-nt><emu-nt params="?Yield">ClassTail<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs constraints="+Default"><emu-constraints>[+Default]</emu-constraints><emu-nt params="?Yield" optional="">DecoratorList<emu-mods> [?Yield] opt</emu-mods></emu-nt><emu-t>class</emu-t><emu-nt params="?Yield">ClassTail<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
<emu-production id="grammar-classexpression" name="ClassExpression" params="Yield, GeneratorParameter">
|
|
<emu-nt>ClassExpression<emu-mods> [Yield, GeneratorParameter]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-nt params="?Yield" optional="">DecoratorList<emu-mods> [?Yield] opt</emu-mods></emu-nt><emu-t>class</emu-t><emu-nt params="?Yield" optional="">BindingIdentifier<emu-mods> [?Yield] opt</emu-mods></emu-nt><emu-nt params="?Yield, ?GeneratorParameter">ClassTail<emu-mods> [?Yield, ?GeneratorParameter]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
<emu-production id="grammar-classelement" name="ClassElement" params="Yield">
|
|
<emu-nt>ClassElement<emu-mods> [Yield]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-nt params="?Yield" optional="">DecoratorList<emu-mods> [?Yield] opt</emu-mods></emu-nt><emu-nt params="?Yield">MethodDefinition<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt params="?Yield" optional="">DecoratorList<emu-mods> [?Yield] opt</emu-mods></emu-nt><emu-t>static</emu-t><emu-nt params="?Yield">MethodDefinition<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-t>;</emu-t></emu-rhs>
|
|
</emu-production>
|
|
<emu-production id="grammar-decoratorlist" name="DecoratorList" params="Yield">
|
|
<emu-nt>DecoratorList<emu-mods> [Yield]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-nt params="?Yield" optional="">DecoratorList<emu-mods> [?Yield] opt</emu-mods></emu-nt><emu-nt params="?Yield">Decorator<emu-mods> [?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
<emu-production id="grammar-decorator" name="Decorator" params="Yield">
|
|
<emu-nt>Decorator<emu-mods> [Yield]</emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-t>@</emu-t><emu-nt params="Decorator, ?Yield">LeftHandSideExpression<emu-mods> [Decorator, ?Yield]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
</emu-annex>
|
|
|
|
<emu-annex id="scripts-and-modules">
|
|
<h1><span class="secnum">A.3</span>Scripts and Modules</h1>
|
|
<emu-production id="grammar-exportdeclaration" name="ExportDeclaration">
|
|
<emu-nt>ExportDeclaration<emu-mods></emu-mods><emu-mods></emu-mods></emu-nt><emu-geq>:</emu-geq><emu-rhs><emu-t>export</emu-t><emu-t>*</emu-t><emu-nt>FromClause<emu-mods></emu-mods></emu-nt><emu-t>;</emu-t></emu-rhs>
|
|
<emu-rhs><emu-t>export</emu-t><emu-nt>ExportClause<emu-mods></emu-mods></emu-nt><emu-nt>FromClause<emu-mods></emu-mods></emu-nt><emu-t>;</emu-t></emu-rhs>
|
|
<emu-rhs><emu-t>export</emu-t><emu-nt>ExportClause<emu-mods></emu-mods></emu-nt><emu-t>;</emu-t></emu-rhs>
|
|
<emu-rhs><emu-t>export</emu-t><emu-nt>VariableStatement<emu-mods></emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-t>export</emu-t><emu-gann>[lookahead ≠ <emu-t>@</emu-t>]</emu-gann><emu-nt>Declaration<emu-mods></emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-t>export</emu-t><emu-t>default</emu-t><emu-nt params="Default">HoistableDeclaration<emu-mods> [Default]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-t>export</emu-t><emu-t>default</emu-t><emu-gann>[lookahead ≠ <emu-t>@</emu-t>]</emu-gann><emu-nt params="Default">ClassDeclaration<emu-mods> [Default]</emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-t>export</emu-t><emu-t>default</emu-t><emu-gann>[lookahead ∉ { <emu-t>function</emu-t>, <emu-t>class</emu-t>, <emu-t>@</emu-t> }]</emu-gann><emu-nt>AssignmentExpression<emu-mods></emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt>DecoratorList<emu-mods></emu-mods></emu-nt><emu-t>export</emu-t><emu-gann>[lookahead ≠ <emu-t>@</emu-t>]</emu-gann><emu-nt>ClassDeclaration<emu-mods></emu-mods></emu-nt></emu-rhs>
|
|
<emu-rhs><emu-nt>DecoratorList<emu-mods></emu-mods></emu-nt><emu-t>export</emu-t><emu-t>default</emu-t><emu-gann>[lookahead ≠ <emu-t>@</emu-t>]</emu-gann><emu-nt params="Default">ClassDeclaration<emu-mods> [Default]</emu-mods></emu-nt></emu-rhs>
|
|
</emu-production>
|
|
</emu-annex>
|
|
</emu-annex></body> |