diff --git a/Reflect.js b/Reflect.js
index 8a3f95b..e1a29c9 100644
--- a/Reflect.js
+++ b/Reflect.js
@@ -1129,4 +1129,3 @@ var Reflect;
}
});
})(Reflect || (Reflect = {}));
-//# sourceMappingURL=Reflect.js.map
\ No newline at end of file
diff --git a/docs/ecmarkup.css b/docs/ecmarkup.css
index cb554c7..de9bbfb 100644
--- a/docs/ecmarkup.css
+++ b/docs/ecmarkup.css
@@ -78,16 +78,43 @@ emu-const {
emu-val {
font-weight: bold;
}
-emu-alg ol, emu-alg ol ol ol ol {
- list-style-type: decimal;
-}
-
-emu-alg ol ol, emu-alg ol ol ol ol ol {
- list-style-type: lower-alpha;
-}
-emu-alg ol ol ol, ol ol ol ol ol ol {
- list-style-type: lower-roman;
+/* depth 1 */
+emu-alg ol,
+/* depth 4 */
+emu-alg ol ol ol ol,
+emu-alg ol.nested-thrice,
+emu-alg ol.nested-twice ol,
+emu-alg ol.nested-once ol ol {
+ list-style-type: decimal;
+}
+
+/* depth 2 */
+emu-alg ol ol,
+emu-alg ol.nested-once,
+/* depth 5 */
+emu-alg ol ol ol ol ol,
+emu-alg ol.nested-four-times,
+emu-alg ol.nested-thrice ol,
+emu-alg ol.nested-twice ol ol,
+emu-alg ol.nested-once ol ol ol {
+ list-style-type: lower-alpha;
+}
+
+/* depth 3 */
+emu-alg ol ol ol,
+emu-alg ol.nested-twice,
+emu-alg ol.nested-once ol,
+/* depth 6 */
+emu-alg ol ol ol ol ol ol,
+emu-alg ol.nested-lots,
+emu-alg ol.nested-four-times ol,
+emu-alg ol.nested-thrice ol ol,
+emu-alg ol.nested-twice ol ol ol,
+emu-alg ol.nested-once ol ol ol ol,
+/* depth 7+ */
+emu-alg ol.nested-lots ol {
+ list-style-type: lower-roman;
}
emu-eqn {
@@ -138,6 +165,10 @@ emu-note > div.note-contents > p:last-of-type {
margin-bottom: 0;
}
+emu-table td code {
+ white-space: normal;
+}
+
emu-figure {
display: block;
}
@@ -162,6 +193,10 @@ emu-table figure {
emu-production {
display: block;
+}
+
+emu-grammar[type="example"] emu-production,
+emu-grammar[type="definition"] emu-production {
margin-top: 1em;
margin-bottom: 1em;
margin-left: 5ex;
@@ -189,6 +224,7 @@ emu-gann {
}
emu-gann emu-t:last-child,
+emu-gann emu-gprose:last-child,
emu-gann emu-nt:last-child {
margin-right: 0;
}
@@ -243,10 +279,6 @@ emu-mods {
font-weight: normal;
}
-emu-production[collapsed] emu-mods {
- display: none;
-}
-
emu-params, emu-opt {
margin-right: 1ex;
font-family: monospace;
@@ -265,6 +297,10 @@ emu-gprose {
font-family: Helvetica, Arial, sans-serif;
}
+emu-production emu-gprose {
+ margin-right: 1ex;
+}
+
h1.shortname {
color: #f60;
font-size: 1.5em;
@@ -292,7 +328,7 @@ h1, h2, h3, h4, h5, h6 {
h1 .secnum {
text-decoration: none;
- margin-right: 10px;
+ margin-right: 5px;
}
h1 span.title {
diff --git a/docs/ecmarkup.js b/docs/ecmarkup.js
index 6ad1a1f..ef29b3f 100644
--- a/docs/ecmarkup.js
+++ b/docs/ecmarkup.js
@@ -5,13 +5,18 @@ function Search(menu) {
this.$search = document.getElementById('menu-search');
this.$searchBox = document.getElementById('menu-search-box');
this.$searchResults = document.getElementById('menu-search-results');
-
+
this.loadBiblio();
-
+
document.addEventListener('keydown', this.documentKeydown.bind(this));
-
+
this.$searchBox.addEventListener('keydown', debounce(this.searchBoxKeydown.bind(this), { stopPropagation: true }));
this.$searchBox.addEventListener('keyup', debounce(this.searchBoxKeyup.bind(this), { stopPropagation: true }));
+
+ // Perform an initial search if the box is not empty.
+ if (this.$searchBox.value) {
+ this.search(this.$searchBox.value);
+ }
}
Search.prototype.loadBiblio = function () {
@@ -51,7 +56,7 @@ Search.prototype.searchBoxKeyup = function (e) {
if (e.keyCode === 13 || e.keyCode === 9) {
return;
}
-
+
this.search(e.target.value);
}
@@ -74,25 +79,23 @@ Search.prototype.triggerSearch = function (e) {
// prefer shorter matches.
function relevance(result, searchString) {
var relevance = 0;
-
+
relevance = Math.max(0, 8 - result.match.chunks) << 7;
-
+
if (result.match.caseMatch) {
relevance *= 2;
}
-
+
if (result.match.prefix) {
relevance += 2048
}
-
+
relevance += Math.max(0, 255 - result.entry.key.length);
-
+
return relevance;
}
Search.prototype.search = function (searchString) {
- var s = Date.now();
-
if (searchString === '') {
this.displayResults([]);
this.hideSearch();
@@ -100,12 +103,12 @@ Search.prototype.search = function (searchString) {
} else {
this.showSearch();
}
-
+
if (searchString.length === 1) {
this.displayResults([]);
return;
}
-
+
var results;
if (/^[\d\.]*$/.test(searchString)) {
@@ -116,7 +119,7 @@ Search.prototype.search = function (searchString) {
});
} else {
results = [];
-
+
for (var i = 0; i < this.biblio.length; i++) {
var entry = this.biblio[i];
if (!entry.key) {
@@ -129,11 +132,11 @@ Search.prototype.search = function (searchString) {
results.push({ entry: entry, match: match });
}
}
-
+
results.forEach(function (result) {
result.relevance = relevance(result, searchString);
});
-
+
results = results.sort(function (a, b) { return b.relevance - a.relevance });
}
@@ -141,7 +144,7 @@ Search.prototype.search = function (searchString) {
if (results.length > 50) {
results = results.slice(0, 50);
}
-
+
this.displayResults(results);
}
Search.prototype.hideSearch = function () {
@@ -158,7 +161,7 @@ Search.prototype.selectResult = function () {
if ($first) {
document.location = $first.getAttribute('href');
}
-
+
this.$searchBox.value = '';
this.$searchBox.blur();
this.displayResults([]);
@@ -172,7 +175,7 @@ Search.prototype.selectResult = function () {
Search.prototype.displayResults = function (results) {
if (results.length > 0) {
this.$searchResults.classList.remove('no-results');
-
+
var html = '
';
results.forEach(function (result) {
@@ -189,7 +192,7 @@ Search.prototype.displayResults = function (results) {
} else if (entry.type === 'production') {
text = entry.key;
cssClass = 'prod';
- id = entry.id;
+ id = entry.id;
} else if (entry.type === 'op') {
text = entry.key;
cssClass = 'op';
@@ -201,7 +204,7 @@ Search.prototype.displayResults = function (results) {
}
if (text) {
- html += ''
+ html += '';
}
});
@@ -224,7 +227,7 @@ function Menu() {
this.$toc = document.querySelector('#menu-toc > ol');
this.$specContainer = document.getElementById('spec-container');
this.search = new Search(this);
-
+
this._pinnedIds = {};
this.loadPinEntries();
@@ -269,9 +272,9 @@ function Menu() {
&& target.offsetHeight + target.scrollTop >= target.scrollHeight;
if (offBottom) {
- e.preventDefault();
- }
- })
+ e.preventDefault();
+ }
+ });
}
Menu.prototype.documentKeydown = function (e) {
@@ -298,7 +301,7 @@ Menu.prototype.revealInToc = function (path) {
current[i].classList.remove('revealed');
current[i].classList.remove('revealed-leaf');
}
-
+
var current = this.$toc;
var index = 0;
while (index < path.length) {
@@ -309,7 +312,7 @@ Menu.prototype.revealInToc = function (path) {
if (index === path.length - 1) {
children[i].classList.add('revealed-leaf');
var rect = children[i].getBoundingClientRect();
- this.$toc.getBoundingClientRect().top
+ // this.$toc.getBoundingClientRect().top;
var tocRect = this.$toc.getBoundingClientRect();
if (rect.top + 10 > tocRect.bottom) {
this.$toc.scrollTop = this.$toc.scrollTop + (rect.top - tocRect.bottom) + (rect.bottom - rect.top);
@@ -320,29 +323,27 @@ Menu.prototype.revealInToc = function (path) {
current = children[i].querySelector('ol');
index++;
break;
- }
+ }
}
-
+
}
}
function findActiveClause(root, path) {
var clauses = new ClauseWalker(root);
var $clause;
- var found = false;
var path = path || [];
-
+
while ($clause = clauses.nextNode()) {
var rect = $clause.getBoundingClientRect();
- var $header = $clause.children[0];
+ var $header = $clause.querySelector("h1");
var marginTop = parseInt(getComputedStyle($header)["margin-top"]);
-
+
if ((rect.top - marginTop) <= 0 && rect.bottom > 0) {
- found = true;
return findActiveClause($clause, path.concat($clause)) || path;
}
}
-
+
return path;
}
@@ -367,7 +368,7 @@ function ClauseWalker(root) {
},
false
);
-
+
return treeWalker;
}
@@ -450,7 +451,7 @@ Menu.prototype.loadPinEntries = function () {
} catch (e) {
return;
}
-
+
var pinsString = window.localStorage.pinEntries;
if (!pinsString) return;
var pins = JSON.parse(pinsString);
@@ -482,6 +483,11 @@ function init() {
$container.addEventListener('mouseover', debounce(function (e) {
Toolbox.activateIfMouseOver(e);
}));
+ document.addEventListener('keydown', debounce(function (e) {
+ if (e.code === "Escape" && Toolbox.active) {
+ Toolbox.deactivate();
+ }
+ }));
}
document.addEventListener('DOMContentLoaded', init);
@@ -580,12 +586,11 @@ function fuzzysearch (searchString, haystack, caseInsensitive) {
var qlen = searchString.length;
var chunks = 1;
var finding = false;
- var prefix = true;
-
+
if (qlen > tlen) {
return false;
}
-
+
if (qlen === tlen) {
if (searchString === haystack) {
return { caseMatch: true, chunks: 1, prefix: true };
@@ -595,7 +600,7 @@ function fuzzysearch (searchString, haystack, caseInsensitive) {
return false;
}
}
-
+
outer: for (var i = 0, j = 0; i < qlen; i++) {
var nch = searchString[i];
while (j < tlen) {
@@ -609,12 +614,12 @@ function fuzzysearch (searchString, haystack, caseInsensitive) {
finding = false;
}
}
-
- if (caseInsensitive) { return false }
-
+
+ if (caseInsensitive) { return false; }
+
return fuzzysearch(searchString.toLowerCase(), haystack.toLowerCase(), true);
}
-
+
return { caseMatch: !caseInsensitive, chunks: chunks, prefix: j <= qlen };
}
@@ -771,7 +776,6 @@ var referencePane = {
var target = document.getElementById(id);
var cid = findParentClauseId(target);
var clause = menu.search.biblio.byId[cid];
- var dupCount = 0;
return { id: id, clause: clause }
}).sort(function (a, b) {
return sortByClauseNumber(a.clause, b.clause);
@@ -811,7 +815,7 @@ function sortByClauseNumber(c1, c2) {
if (i >= c2c.length) {
return 1;
}
-
+
var c1 = c1c[i];
var c2 = c2c[i];
var c1cn = Number(c1);
diff --git a/docs/index.html b/docs/index.html
index 1afdd8d..78eb316 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -16,13 +16,18 @@
this.$search = document.getElementById('menu-search');
this.$searchBox = document.getElementById('menu-search-box');
this.$searchResults = document.getElementById('menu-search-results');
-
+
this.loadBiblio();
-
+
document.addEventListener('keydown', this.documentKeydown.bind(this));
-
+
this.$searchBox.addEventListener('keydown', debounce(this.searchBoxKeydown.bind(this), { stopPropagation: true }));
this.$searchBox.addEventListener('keyup', debounce(this.searchBoxKeyup.bind(this), { stopPropagation: true }));
+
+ // Perform an initial search if the box is not empty.
+ if (this.$searchBox.value) {
+ this.search(this.$searchBox.value);
+ }
}
Search.prototype.loadBiblio = function () {
@@ -62,7 +67,7 @@
if (e.keyCode === 13 || e.keyCode === 9) {
return;
}
-
+
this.search(e.target.value);
}
@@ -85,25 +90,23 @@
// prefer shorter matches.
function relevance(result, searchString) {
var relevance = 0;
-
+
relevance = Math.max(0, 8 - result.match.chunks) << 7;
-
+
if (result.match.caseMatch) {
relevance *= 2;
}
-
+
if (result.match.prefix) {
relevance += 2048
}
-
+
relevance += Math.max(0, 255 - result.entry.key.length);
-
+
return relevance;
}
Search.prototype.search = function (searchString) {
- var s = Date.now();
-
if (searchString === '') {
this.displayResults([]);
this.hideSearch();
@@ -111,12 +114,12 @@
} else {
this.showSearch();
}
-
+
if (searchString.length === 1) {
this.displayResults([]);
return;
}
-
+
var results;
if (/^[\d\.]*$/.test(searchString)) {
@@ -127,7 +130,7 @@
});
} else {
results = [];
-
+
for (var i = 0; i < this.biblio.length; i++) {
var entry = this.biblio[i];
if (!entry.key) {
@@ -140,11 +143,11 @@
results.push({ entry: entry, match: match });
}
}
-
+
results.forEach(function (result) {
result.relevance = relevance(result, searchString);
});
-
+
results = results.sort(function (a, b) { return b.relevance - a.relevance });
}
@@ -152,7 +155,7 @@
if (results.length > 50) {
results = results.slice(0, 50);
}
-
+
this.displayResults(results);
}
Search.prototype.hideSearch = function () {
@@ -169,7 +172,7 @@
if ($first) {
document.location = $first.getAttribute('href');
}
-
+
this.$searchBox.value = '';
this.$searchBox.blur();
this.displayResults([]);
@@ -183,7 +186,7 @@
Search.prototype.displayResults = function (results) {
if (results.length > 0) {
this.$searchResults.classList.remove('no-results');
-
+
var html = '';
results.forEach(function (result) {
@@ -200,7 +203,7 @@
} else if (entry.type === 'production') {
text = entry.key;
cssClass = 'prod';
- id = entry.id;
+ id = entry.id;
} else if (entry.type === 'op') {
text = entry.key;
cssClass = 'op';
@@ -212,7 +215,7 @@
}
if (text) {
- html += ''
+ html += '';
}
});
@@ -235,7 +238,7 @@
this.$toc = document.querySelector('#menu-toc > ol');
this.$specContainer = document.getElementById('spec-container');
this.search = new Search(this);
-
+
this._pinnedIds = {};
this.loadPinEntries();
@@ -280,9 +283,9 @@
&& target.offsetHeight + target.scrollTop >= target.scrollHeight;
if (offBottom) {
- e.preventDefault();
- }
- })
+ e.preventDefault();
+ }
+ });
}
Menu.prototype.documentKeydown = function (e) {
@@ -309,7 +312,7 @@
current[i].classList.remove('revealed');
current[i].classList.remove('revealed-leaf');
}
-
+
var current = this.$toc;
var index = 0;
while (index < path.length) {
@@ -320,7 +323,7 @@
if (index === path.length - 1) {
children[i].classList.add('revealed-leaf');
var rect = children[i].getBoundingClientRect();
- this.$toc.getBoundingClientRect().top
+ // this.$toc.getBoundingClientRect().top;
var tocRect = this.$toc.getBoundingClientRect();
if (rect.top + 10 > tocRect.bottom) {
this.$toc.scrollTop = this.$toc.scrollTop + (rect.top - tocRect.bottom) + (rect.bottom - rect.top);
@@ -331,29 +334,27 @@
current = children[i].querySelector('ol');
index++;
break;
- }
+ }
}
-
+
}
}
function findActiveClause(root, path) {
var clauses = new ClauseWalker(root);
var $clause;
- var found = false;
var path = path || [];
-
+
while ($clause = clauses.nextNode()) {
var rect = $clause.getBoundingClientRect();
- var $header = $clause.children[0];
+ var $header = $clause.querySelector("h1");
var marginTop = parseInt(getComputedStyle($header)["margin-top"]);
-
+
if ((rect.top - marginTop) <= 0 && rect.bottom > 0) {
- found = true;
return findActiveClause($clause, path.concat($clause)) || path;
}
}
-
+
return path;
}
@@ -378,7 +379,7 @@
},
false
);
-
+
return treeWalker;
}
@@ -461,7 +462,7 @@
} catch (e) {
return;
}
-
+
var pinsString = window.localStorage.pinEntries;
if (!pinsString) return;
var pins = JSON.parse(pinsString);
@@ -493,6 +494,11 @@
$container.addEventListener('mouseover', debounce(function (e) {
Toolbox.activateIfMouseOver(e);
}));
+ document.addEventListener('keydown', debounce(function (e) {
+ if (e.code === "Escape" && Toolbox.active) {
+ Toolbox.deactivate();
+ }
+ }));
}
document.addEventListener('DOMContentLoaded', init);
@@ -591,12 +597,11 @@
var qlen = searchString.length;
var chunks = 1;
var finding = false;
- var prefix = true;
-
+
if (qlen > tlen) {
return false;
}
-
+
if (qlen === tlen) {
if (searchString === haystack) {
return { caseMatch: true, chunks: 1, prefix: true };
@@ -606,7 +611,7 @@
return false;
}
}
-
+
outer: for (var i = 0, j = 0; i < qlen; i++) {
var nch = searchString[i];
while (j < tlen) {
@@ -620,12 +625,12 @@
finding = false;
}
}
-
- if (caseInsensitive) { return false }
-
+
+ if (caseInsensitive) { return false; }
+
return fuzzysearch(searchString.toLowerCase(), haystack.toLowerCase(), true);
}
-
+
return { caseMatch: !caseInsensitive, chunks: chunks, prefix: j <= qlen };
}
@@ -782,7 +787,6 @@
var target = document.getElementById(id);
var cid = findParentClauseId(target);
var clause = menu.search.biblio.byId[cid];
- var dupCount = 0;
return { id: id, clause: clause }
}).sort(function (a, b) {
return sortByClauseNumber(a.clause, b.clause);
@@ -822,7 +826,7 @@
if (i >= c2c.length) {
return 1;
}
-
+
var c1 = c1c[i];
var c2 = c2c[i];
var c1cn = Number(c1);
@@ -982,16 +986,43 @@
emu-val {
font-weight: bold;
}
-emu-alg ol, emu-alg ol ol ol ol {
- list-style-type: decimal;
-}
-emu-alg ol ol, emu-alg ol ol ol ol ol {
- list-style-type: lower-alpha;
-}
-
-emu-alg ol ol ol, ol ol ol ol ol ol {
- list-style-type: lower-roman;
+/* depth 1 */
+emu-alg ol,
+/* depth 4 */
+emu-alg ol ol ol ol,
+emu-alg ol.nested-thrice,
+emu-alg ol.nested-twice ol,
+emu-alg ol.nested-once ol ol {
+ list-style-type: decimal;
+}
+
+/* depth 2 */
+emu-alg ol ol,
+emu-alg ol.nested-once,
+/* depth 5 */
+emu-alg ol ol ol ol ol,
+emu-alg ol.nested-four-times,
+emu-alg ol.nested-thrice ol,
+emu-alg ol.nested-twice ol ol,
+emu-alg ol.nested-once ol ol ol {
+ list-style-type: lower-alpha;
+}
+
+/* depth 3 */
+emu-alg ol ol ol,
+emu-alg ol.nested-twice,
+emu-alg ol.nested-once ol,
+/* depth 6 */
+emu-alg ol ol ol ol ol ol,
+emu-alg ol.nested-lots,
+emu-alg ol.nested-four-times ol,
+emu-alg ol.nested-thrice ol ol,
+emu-alg ol.nested-twice ol ol ol,
+emu-alg ol.nested-once ol ol ol ol,
+/* depth 7+ */
+emu-alg ol.nested-lots ol {
+ list-style-type: lower-roman;
}
emu-eqn {
@@ -1042,6 +1073,10 @@
margin-bottom: 0;
}
+emu-table td code {
+ white-space: normal;
+}
+
emu-figure {
display: block;
}
@@ -1066,6 +1101,10 @@
emu-production {
display: block;
+}
+
+emu-grammar[type="example"] emu-production,
+emu-grammar[type="definition"] emu-production {
margin-top: 1em;
margin-bottom: 1em;
margin-left: 5ex;
@@ -1093,6 +1132,7 @@
}
emu-gann emu-t:last-child,
+emu-gann emu-gprose:last-child,
emu-gann emu-nt:last-child {
margin-right: 0;
}
@@ -1147,10 +1187,6 @@
font-weight: normal;
}
-emu-production[collapsed] emu-mods {
- display: none;
-}
-
emu-params, emu-opt {
margin-right: 1ex;
font-family: monospace;
@@ -1169,6 +1205,10 @@
font-family: Helvetica, Arial, sans-serif;
}
+emu-production emu-gprose {
+ margin-right: 1ex;
+}
+
h1.shortname {
color: #f60;
font-size: 1.5em;
@@ -1196,7 +1236,7 @@
h1 .secnum {
text-decoration: none;
- margin-right: 10px;
+ margin-right: 5px;
}
h1 span.title {
@@ -1815,12 +1855,12 @@
Metadata Proposal - ECMAScript
- Note
+ Note
Proposal to add Metadata to ECMAScript.
- 1Syntax
+ 1 Syntax
NoteThis section is non-normative.
Reflect.defineMetadata(metadataKey, metadataValue, target);
@@ -1875,7 +1915,7 @@ 1Syntax
}
@Type(String)
- get name() { return "text"; }
+ get name() { return "text"; }
@Type(Function)
@ParamTypes(Number, Number)
@@ -1887,202 +1927,177 @@ 1Syntax
let obj = new C("a", 1);
-let paramTypes = Reflect.getMetadata("design:paramtypes", inst, "add");
+let paramTypes = Reflect.getMetadata("design:paramtypes", obj, "add");
- 2Abstract Operations
+ 2 Abstract Operations
- 2.1Operations on Objects
+ 2.1 Operations on Objects
- 2.1.1GetOrCreateMetadataMap ( O, P, Create )
+ 2.1.1 GetOrCreateMetadataMap ( O, P, Create )
When the abstract operation GetOrCreateMetadataMap is called with Object O, property key P, and Boolean Create the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let targetMetadata be the value of O's [[Metadata]] internal slot.
- If targetMetadata is undefined, then
- If Create is false, return undefined.
- Set targetMetadata to be a newly created Map object.
- Set the [[Metadata]] internal slot of O to targetMetadata.
- Let metadataMap be ? Invoke(targetMetadata,
"get"
, P). - If metadataMap is undefined, then
- If Create is false, return undefined.
- Set metadataMap to be a newly created Map object.
- Perform ? Invoke(targetMetadata,
"set"
, P, metadataMap).
- Return metadataMap.
-
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let targetMetadata be the value of O's [[Metadata]] internal slot.
- If targetMetadata is undefined, then
- If Create is false, return undefined.
- Set targetMetadata to be a newly created Map object.
- Set the [[Metadata]] internal slot of O to targetMetadata.
- Let metadataMap be ? Invoke(targetMetadata,
"get"
, P). - If metadataMap is undefined, then
- If Create is false, return undefined.
- Set metadataMap to be a newly created Map object.
- Perform ? Invoke(targetMetadata,
"set"
, P, metadataMap).
- Return metadataMap.
- 3Ordinary and Exotic Objects Behaviors
+ 3 Ordinary and Exotic Objects Behaviors
- 3.1Ordinary Object Internal Methods and Internal Slots
+ 3.1 Ordinary Object Internal Methods and Internal Slots
All ordinary objects have an internal slot called [[Metadata]]. The value of this internal slot is either null or a Map object and is used for storing metadata for an object.
- 3.1.1[[HasMetadata]] ( MetadataKey, P )
- When the [[HasMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:
- - Return ? OrdinaryHasMetadata(MetadataKey, O, P).
-
+ 3.1.1 [[HasMetadata]] ( MetadataKey, P )
+ When the [[HasMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:
+ - Return ? OrdinaryHasMetadata(MetadataKey, O, P).
- 3.1.1.1OrdinaryHasMetadata ( MetadataKey, O, P )
- When the abstract operation OrdinaryHasMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let hasOwn be ? OrdinaryHasOwnMetadata(MetadataKey, O, P).
- If hasOwn is true, return true.
- Let parent be ? O.[[GetPrototypeOf]]().
- If parent is not null, Return ? parent.[[HasMetadata]](MetadataKey, P).
- Return false.
-
+ 3.1.1.1 OrdinaryHasMetadata ( MetadataKey, O, P )
+ When the abstract operation OrdinaryHasMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let hasOwn be ? OrdinaryHasOwnMetadata(MetadataKey, O, P).
- If hasOwn is true, return true.
- Let parent be ? O.[[GetPrototypeOf]]().
- If parent is not null, Return ? parent.[[HasMetadata]](MetadataKey, P).
- Return false.
- 3.1.2[[HasOwnMetadata]] ( MetadataKey, P )
- When the [[HasOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:
- - Return ? OrdinaryHasOwnMetadata(MetadataKey, O, P).
-
+ 3.1.2 [[HasOwnMetadata]] ( MetadataKey, P )
+ When the [[HasOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:
+ - Return ? OrdinaryHasOwnMetadata(MetadataKey, O, P).
- 3.1.2.1OrdinaryHasOwnMetadata ( MetadataKey, O, P )
- When the abstract operation OrdinaryHasOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
- If metadataMap is undefined, return false.
- Return ? ToBoolean(? Invoke(metadataMap,
"has"
, MetadataKey)).
-
+ 3.1.2.1 OrdinaryHasOwnMetadata ( MetadataKey, O, P )
+ When the abstract operation OrdinaryHasOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
- If metadataMap is undefined, return false.
- Return ? ToBoolean(? Invoke(metadataMap,
"has"
, MetadataKey)).
- 3.1.3[[GetMetadata]] ( MetadataKey, P )
- When the [[GetMatadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:
- - Return ? OrdinaryGetMetadata(MetadataKey, O, P).
-
+ 3.1.3 [[GetMetadata]] ( MetadataKey, P )
+ When the [[GetMatadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:
+ - Return ? OrdinaryGetMetadata(MetadataKey, O, P).
- 3.1.3.1OrdinaryGetMetadata ( MetadataKey, O, P )
- When the abstract operation OrdinaryGetMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let hasOwn be ? OrdinaryHasOwnMetadata(MetadataKey, O, P).
- If hasOwn is true, return ? OrdinaryGetOwnMetadata(MetadataKey, O, P).
- Let parent be ? O.[[GetPrototypeOf]]().
- If parent is not null, return ? parent.[[GetMetadata]](MetadataKey, P).
- Return undefined.
-
+ 3.1.3.1 OrdinaryGetMetadata ( MetadataKey, O, P )
+ When the abstract operation OrdinaryGetMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let hasOwn be ? OrdinaryHasOwnMetadata(MetadataKey, O, P).
- If hasOwn is true, return ? OrdinaryGetOwnMetadata(MetadataKey, O, P).
- Let parent be ? O.[[GetPrototypeOf]]().
- If parent is not null, return ? parent.[[GetMetadata]](MetadataKey, P).
- Return undefined.
- 3.1.4[[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )
- When the [[GetOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:
- - Return ? OrdinaryGetOwnMetadata(MetadataKey, O, P).
-
+ 3.1.4 [[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )
+ When the [[GetOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:
+ - Return ? OrdinaryGetOwnMetadata(MetadataKey, O, P).
- 3.1.4.1OrdinaryGetOwnMetadata ( MetadataKey, O, P )
- When the abstract operation OrdinaryGetOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
- If metadataMap is undefined, return undefined.
- Return ? Invoke(metadataMap,
"get"
, MetadataKey).
-
+ 3.1.4.1 OrdinaryGetOwnMetadata ( MetadataKey, O, P )
+ When the abstract operation OrdinaryGetOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
- If metadataMap is undefined, return undefined.
- Return ? Invoke(metadataMap,
"get"
, MetadataKey).
- 3.1.5[[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )
- When the [[DefineOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, and property key P, the following steps are taken:
- - Return ? OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)
-
+ 3.1.5 [[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )
+ When the [[DefineOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, and property key P, the following steps are taken:
+ - Return ? OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)
- 3.1.5.1OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )
- When the abstract operation OrdinaryDefineOwnProperty is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, Object O, and property key P, the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, true).
- Return ? Invoke(metadataMap,
"set"
, MetadataKey, MetadataValue).
-
+ 3.1.5.1 OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )
+ When the abstract operation OrdinaryDefineOwnProperty is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, Object O, and property key P, the following steps are taken:
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, true).
- Return ? Invoke(metadataMap,
"set"
, MetadataKey, MetadataValue).
- 3.1.6[[MetadataKeys]] ( P )
+ 3.1.6 [[MetadataKeys]] ( P )
When the [[MetadataKeys]] internal method of O is called with property key P the following steps are taken:
- - Return ? OrdinaryMetadataKeys(O, P).
-
+ - Return ? OrdinaryMetadataKeys(O, P).
- 3.1.6.1OrdinaryMetadataKeys ( O, P )
+ 3.1.6.1 OrdinaryMetadataKeys ( O, P )
When the abstract operation OrdinaryMetadataKeys is called with Object O and property key P the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let ownKeys be ? OrdinaryOwnMetadataKeys(O, P).
- Let parent be ? O.[[GetPrototypeOf]]().
- If parent is null, then return ownKeys.
- Let parentKeys be ? O.[[OrdinaryMetadataKeys]](P).
- Let ownKeysLen = ? Get(ownKeys, "length").
- If ownKeysLen is 0, return parentKeys.
- Let parentKeysLen = ? Get(parentKeys, "length").
- If parentKeysLen is 0, return ownKeys.
- Let set be a newly created Set object.
- Let keys be ? ArrayCreate(0).
- Let k be 0.
- For each element key of ownKeys
- Let hasKey be ? Invoke(set,
"has"
, key). - If hasKey is false, then
- Let Pk be ! ToString(k).
- Perform ? Invoke(set, "add", key).
- Let defineStatus be CreateDataProperty(keys, Pk, key).
- Assert: defineStatus is true.
- Increase k by 1.
- For each element key of parentKeys
- Let hasKey be ? Invoke(set,
"has"
, key). - If hasKey is false, then
- Let Pk be ! ToString(k).
- Perform ? Invoke(set,
"add"
, key). - Let defineStatus be CreateDataProperty(keys, Pk, key).
- Assert: defineStatus is true.
- Increase k by 1.
- Perform ? Set(keys,
"length"
, k). - return keys.
-
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let ownKeys be ? OrdinaryOwnMetadataKeys(O, P).
- Let parent be ? O.[[GetPrototypeOf]]().
- If parent is null, then return ownKeys.
- Let parentKeys be ? O.[[OrdinaryMetadataKeys]](P).
- Let ownKeysLen = ? Get(ownKeys, "length").
- If ownKeysLen is 0, return parentKeys.
- Let parentKeysLen = ? Get(parentKeys, "length").
- If parentKeysLen is 0, return ownKeys.
- Let set be a newly created Set object.
- Let keys be ? ArrayCreate(0).
- Let k be 0.
- For each element key of ownKeys
- Let hasKey be ? Invoke(set,
"has"
, key). - If hasKey is false, then
- Let Pk be ! ToString(k).
- Perform ? Invoke(set, "add", key).
- Let defineStatus be CreateDataProperty(keys, Pk, key).
- Assert: defineStatus is true.
- Increase k by 1.
- For each element key of parentKeys
- Let hasKey be ? Invoke(set,
"has"
, key). - If hasKey is false, then
- Let Pk be ! ToString(k).
- Perform ? Invoke(set,
"add"
, key). - Let defineStatus be CreateDataProperty(keys, Pk, key).
- Assert: defineStatus is true.
- Increase k by 1.
- Perform ? Set(keys,
"length"
, k). - return keys.
- 3.1.7[[OwnMetadataKeys]] ( P )
+ 3.1.7 [[OwnMetadataKeys]] ( P )
When the [[OwnMetadataKeys]] internal method of O is called with property key P the following steps are taken:
- - Return OrdinaryOwnMetadataKeys(O, P).
-
+ - Return OrdinaryOwnMetadataKeys(O, P).
- 3.1.7.1OrdinaryOwnMetadataKeys ( O, P )
+ 3.1.7.1 OrdinaryOwnMetadataKeys ( O, P )
When the abstract operation OrdinaryOwnMetadataKeys is called with Object O and property key P the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let keys be ? ArrayCreate(0).
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
- If metadataMap is undefined, return keys.
- Let keysObj be ? Invoke(metadataMap,
"keys"
). - Let iterator be ? GetIterator(keysObj).
- Let k be 0.
- Repeat
- Let Pk be ! ToString(k).
- Let next be ? IteratorStep(iterator).
- If next is false, then
- Let setStatus be ? Set(keys,
"length"
, k, true). - Assert: setStatus is true.
- Return keys.
- Let nextValue be ? IteratorValue(next).
- Let defineStatus be CreateDataPropertyOrThrow(keys, Pk, nextValue).
- If defineStatus is an abrupt completion, return ? IteratorClose(iterator, defineStatus).
- Increase k by 1.
-
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let keys be ? ArrayCreate(0).
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
- If metadataMap is undefined, return keys.
- Let keysObj be ? Invoke(metadataMap,
"keys"
). - Let iterator be ? GetIterator(keysObj).
- Let k be 0.
- Repeat
- Let Pk be ! ToString(k).
- Let next be ? IteratorStep(iterator).
- If next is false, then
- Let setStatus be ? Set(keys,
"length"
, k, true). - Assert: setStatus is true.
- Return keys.
- Let nextValue be ? IteratorValue(next).
- Let defineStatus be CreateDataPropertyOrThrow(keys, Pk, nextValue).
- If defineStatus is an abrupt completion, return ? IteratorClose(iterator, defineStatus).
- Increase k by 1.
- 3.1.8[[DeleteMetadata]]( MetadataKey, P )
- When the [[DeleteMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P the following steps are taken:
- - Assert: P is undefined or IsPropertyKey(P) is true.
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
- If metadataMap is undefined, return false.
- Return ? Invoke(metadataMap,
"delete"
, MetadataKey).
-
+ 3.1.8 [[DeleteMetadata]]( MetadataKey, P )
+ When the [[DeleteMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P the following steps are taken:
+ - Assert: P is undefined or IsPropertyKey(P) is true.
- Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
- If metadataMap is undefined, return false.
- Return ? Invoke(metadataMap,
"delete"
, MetadataKey).
- 4Reflection
+ 4 Reflection
- 4.1The Reflect Object
+ 4.1 The Reflect Object
This section contains amendments to the Reflect object.
- 4.1.1Metadata Decorator Functions
+ 4.1.1 Metadata Decorator Functions
A metadata decorator function is an anonymous built-in function that has [[MetadataKey]] and [[MetadataValue]] internal slots.
When a metadata decorator function F is called with arguments target and key, the following steps are taken:
- - Assert: F has a [[MetadataKey]] internal slot whose value is an ECMAScript language value, or undefined.
- Assert: F has a [[MetadataValue]] internal slot whose value is an ECMAScript language value, or undefined.
- If Type(target) is not Object, throw a TypeError exception.
- If key is not undefined and IsPropertyKey(key) is false, throw a TypeError exception.
- Let metadataKey be the value of F's [[MetadataKey]] internal slot.
- Let metadataValue be the value of F's [[MetadataValue]] internal slot.
- Perform ? target.[[DefineMetadata]](metadataKey, metadataValue, target, key).
- Return undefined.
-
+ - Assert: F has a [[MetadataKey]] internal slot whose value is an ECMAScript language value, or undefined.
- Assert: F has a [[MetadataValue]] internal slot whose value is an ECMAScript language value, or undefined.
- If Type(target) is not Object, throw a TypeError exception.
- If key is not undefined and IsPropertyKey(key) is false, throw a TypeError exception.
- Let metadataKey be the value of F's [[MetadataKey]] internal slot.
- Let metadataValue be the value of F's [[MetadataValue]] internal slot.
- Perform ? target.[[DefineMetadata]](metadataKey, metadataValue, target, key).
- Return undefined.
- 4.1.2Reflect.metadata ( metadataKey, metadataValue )
+ 4.1.2 Reflect.metadata ( metadataKey, metadataValue )
When the metadata
function is called with arguments metadataKey and metadataValue, the following steps are taken:
- - Let decorator be a new built-in function object as defined in Metadata Decorator Functions.
- Set the [[MetadataKey]] internal slot of decorator to metadataKey.
- Set the [[MetadataValue]] internal slot of decorator to metadataValue.
- Return decorator.
-
+ - Let decorator be a new built-in function object as defined in Metadata Decorator Functions.
- Set the [[MetadataKey]] internal slot of decorator to metadataKey.
- Set the [[MetadataValue]] internal slot of decorator to metadataValue.
- Return decorator.
- 4.1.3Reflect.defineMetadata ( metadataKey, metadataValue, target [, propertyKey] )
+ 4.1.3 Reflect.defineMetadata ( metadataKey, metadataValue, target [, propertyKey] )
When the defineMetadata
function is called with arguments metadataKey, metadataValue, target, and propertyKey, the following steps are taken:
- - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[DefineMetadata]](metadataKey, metadataValue, propertyKey).
-
+ - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[DefineMetadata]](metadataKey, metadataValue, propertyKey).
- 4.1.4Reflect.hasMetadata ( metadataKey, target [, propertyKey] )
+ 4.1.4 Reflect.hasMetadata ( metadataKey, target [, propertyKey] )
When the hasMetadata
function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:
- - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[HasMetadata]](metadataKey, propertyKey).
-
+ - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[HasMetadata]](metadataKey, propertyKey).
- 4.1.5Reflect.hasOwnMetadata ( metadataKey, target [, propertyKey] )
+ 4.1.5 Reflect.hasOwnMetadata ( metadataKey, target [, propertyKey] )
When the hasOwnMetadata
function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:
- - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[HasOwn]](metadataKey, propertyKey).
-
+ - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[HasOwn]](metadataKey, propertyKey).
- 4.1.6Reflect.getMetadata ( metadataKey, target [, propertyKey] )
+ 4.1.6 Reflect.getMetadata ( metadataKey, target [, propertyKey] )
When the getMetadata
function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:
- - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[GetMetadata]](metadataKey, propertyKey).
-
+ - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[GetMetadata]](metadataKey, propertyKey).
- 4.1.7Reflect.getOwnMetadata ( metadataKey, target [, propertyKey] )
+ 4.1.7 Reflect.getOwnMetadata ( metadataKey, target [, propertyKey] )
When the getOwnMetadata
function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:
- - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[GetOwnMetadata]](metadataKey, propertyKey).
-
+ - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[GetOwnMetadata]](metadataKey, propertyKey).
- 4.1.8Reflect.getMetadataKeys ( target [, propertyKey] )
+ 4.1.8 Reflect.getMetadataKeys ( target [, propertyKey] )
When the getMetadataKeys
function is called with arguments target and propertyKey, the following steps are taken:
- - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[GetMetadataKeys]](propertyKey).
-
+ - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[GetMetadataKeys]](propertyKey).
- 4.1.9Reflect.getOwnMetadataKeys ( target [, propertyKey] )
+ 4.1.9 Reflect.getOwnMetadataKeys ( target [, propertyKey] )
When the getOwnMetadataKeys
function is called with arguments target and propertyKey, the following steps are taken:
- - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[GetOwnMetadataKeys]](propertyKey).
-
+ - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[GetOwnMetadataKeys]](propertyKey).
- 4.1.10Reflect.deleteMetadata ( metadataKey, target [, propertyKey] )
+ 4.1.10 Reflect.deleteMetadata ( metadataKey, target [, propertyKey] )
When the deleteMetadata
function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:
- - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[DeleteMetadata]](metadataKey, propertyKey).
-
+ - If Type(target) is not Object, throw a TypeError exception.
- Return ? target.[[DeleteMetadata]](metadataKey, propertyKey).
-