From 4cc44df8e8c679dd731b2c2118b7fc78ee8ad319 Mon Sep 17 00:00:00 2001 From: legendecas Date: Fri, 26 Feb 2021 17:12:14 +0800 Subject: [PATCH 01/13] spec: update second parameter of error constructor with options bag --- spec.emu | 63 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/spec.emu b/spec.emu index e95938f..7411ee9 100644 --- a/spec.emu +++ b/spec.emu @@ -29,6 +29,53 @@ contributors: Chengzhong Wu, Hemanth HM, Ecma International

Placeholder to ensure correct clause numbering

Placeholder to ensure correct clause numbering

Placeholder to ensure correct clause numbering

+ + +

Abstract Operations

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+ +

Operations on Objects

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+

Placeholder to ensure correct clause numbering

+ +

GetOption ( _options_, _property_ )

+

The abstract operation GetOption extracts the value of the property named _property_ from the provided _options_ object.

+ + 1. If Type(_options_) is not Object, then + 1. Return *undefined*. + 1. Let _value_ be ? Get(_options_, _property_). + 1. Return _value_. + +
+
+ + +
+

Placeholder to ensure correct clause numbering

Placeholder to ensure correct clause numbering

Placeholder to ensure correct clause numbering

@@ -42,7 +89,6 @@ contributors: Chengzhong Wu, Hemanth HM, Ecma International

Placeholder to ensure correct clause numbering

Placeholder to ensure correct clause numbering

-

Fundamental Objects

@@ -56,9 +102,9 @@ contributors: Chengzhong Wu, Hemanth HM, Ecma International

The Error Constructor

-

Error ( _message_ [ , _cause_ ] )

+

Error ( _message_ [ , _options_ ] )

-

When the `Error` function is called with argument _message_ and _cause_, the following steps are taken:

+

When the `Error` function is called with argument _message_ and _options_, the following steps are taken:

1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget. @@ -67,6 +113,7 @@ contributors: Chengzhong Wu, Hemanth HM, Ecma International 1. Let _msg_ be ? ToString(_message_). 1. Let _msgDesc_ be the PropertyDescriptor { [[Value]]: _msg_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }. 1. Perform ! DefinePropertyOrThrow(_O_, `"message"`, _msgDesc_). + 1. Let _cause_ be ? GetOption(_options_, `"cause"`) 1. If _cause_ is not *undefined*, then 1. Let _causeDesc_ be the PropertyDescriptor { [[Value]]: _cause_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }. 1. Perform ! DefinePropertyOrThrow(_O_, `"cause"`, _causeDesc_). @@ -86,8 +133,8 @@ contributors: Chengzhong Wu, Hemanth HM, Ecma International

The _NativeError_ Constructors

-

_NativeError_ ( _message_ [ , _cause_ ] )

-

When a _NativeError_ function is called with argument _message_ and _cause_, the following steps are taken:

+

_NativeError_ ( _message_ [ , _options_ ] )

+

When a _NativeError_ function is called with argument _message_ and _options_, the following steps are taken:

1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget. 1. [id="step-nativerror-ordinarycreatefromconstructor"] Let _O_ be ? OrdinaryCreateFromConstructor(_newTarget_, "%NativeError.prototype%", « [[ErrorData]] »). @@ -95,6 +142,7 @@ contributors: Chengzhong Wu, Hemanth HM, Ecma International 1. Let _msg_ be ? ToString(_message_). 1. Let _msgDesc_ be the PropertyDescriptor { [[Value]]: _msg_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }. 1. Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_). + 1. Let _cause_ be ? GetOption(_options_, `"cause"`) 1. If _cause_ is not *undefined*, then 1. Let _causeDesc_ be the PropertyDescriptor { [[Value]]: _cause_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }. 1. Perform ! DefinePropertyOrThrow(_O_, `"cause"`, _causeDesc_). @@ -112,8 +160,8 @@ contributors: Chengzhong Wu, Hemanth HM, Ecma International

The AggregateError Constructor

-

AggregateError ( _errors_, _message_ [ , _cause_ ] )

-

When the *AggregateError* function is called with arguments _errors_ and, _message_, and _cause_, the following steps are taken:

+

AggregateError ( _errors_, _message_ [ , _options_ ] )

+

When the *AggregateError* function is called with arguments _errors_ and, _message_, and _options_, the following steps are taken:

1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget. 1. Let _O_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%AggregateError.prototype%"*, « [[ErrorData]] »). @@ -121,6 +169,7 @@ contributors: Chengzhong Wu, Hemanth HM, Ecma International 1. Let _msg_ be ? ToString(_message_). 1. Let _msgDesc_ be the PropertyDescriptor { [[Value]]: _msg_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }. 1. Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_). + 1. Let _cause_ be ? GetOption(_options_, `"cause"`) 1. If _cause_ is not *undefined*, then 1. Let _causeDesc_ be the PropertyDescriptor { [[Value]]: _cause_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }. 1. Perform ! DefinePropertyOrThrow(_O_, `"cause"`, _causeDesc_). From 49c4c3e58a5be527818a9e8c12349c0108e0ee33 Mon Sep 17 00:00:00 2001 From: legendecas Date: Fri, 26 Feb 2021 09:13:11 +0000 Subject: [PATCH 02/13] fixup: [spec] `npm run build` --- index.html | 97 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 28 deletions(-) diff --git a/index.html b/index.html index b2f8867..455d4bc 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Error Cause -Error Cause -Error Cause -Error Cause -Error Cause