From ec1c6e471c8c0986d9d5c5f980b0d0e24e89ee00 Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Tue, 23 Jun 2020 21:30:51 +0100 Subject: [PATCH 1/5] Add a minimal spec --- .gitattributes | 3 + .gitignore | 42 ++ .npmrc | 1 + LICENSE | 21 + index.html | 1971 ++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 17 + spec.emu | 167 ++++ 7 files changed, 2222 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 LICENSE create mode 100644 index.html create mode 100644 package.json create mode 100644 spec.emu diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..31e2b43 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +index.html -diff merge=ours +spec.js -diff merge=ours +spec.css -diff merge=ours diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c8cdd1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Only apps should have lockfiles +yarn.lock +package-lock.json +npm-shrinkwrap.json diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ab51301 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 ECMA TC39 and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/index.html b/index.html new file mode 100644 index 0000000..0abef7e --- /dev/null +++ b/index.html @@ -0,0 +1,1971 @@ + +Slice notation

Stage 1 Draft / June 23, 2020

Slice notation

+ + +

1 Well-Known Symbols

+

Well-known symbols are built-in Symbol values that are explicitly referenced by algorithms of this specification. They are typically used as the keys of properties whose values serve as extension points of a specification algorithm. Unless otherwise specified, well-known symbols values are shared by all realms (8.2).

+

Within this specification a well-known symbol is referred to by using a notation of the form @@name, where “name” is one of the values listed in Table 1.

+
Table 1: Well-known Symbols
+ + + + + + + + + + + + + +
+ Specification Name + + [[Description]] + + Value and Purpose +
+ @@slice + + "Symbol.slice" + + A method that slices the receiver based on a start and end index. +
+
+
+ + +

2 Properties of the Symbol Constructor

+ +

2.1 Symbol.slice

+

The initial value of Symbol.slice is the well known symbol @@slice (Table 1).

+

This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.

+
+
+ + +

3 Properties of the Array Prototype

+ +

3.1 Array.prototype [ @@slice ] (start, end)

+

The initial value of the @@slice property is the same function object as the initial value of the Array.prototype.slice property.

+
+
+ + +

4 Properties of the %TypedArray.prototype% Object

+ +

4.1 %TypedArray%.prototype [ @@slice ] (start, end)

+

The initial value of the @@slice property is the same function object as the initial value of the %TypedArray%.prototype.slice property.

+
+
+ + +

5 Properties of the ArrayBuffer Prototype Object

+ +

5.1 ArrayBuffer.prototype [ @@slice ] (start, end)

+

The initial value of the @@slice property is the same function object as the initial value of the ArrayBuffer.prototype.slice property.

+
+
+ + +

6 Properties of the SharedArrayBuffer Prototype Object

+ +

6.1 SharedArrayBuffer.prototype [ @@slice ] (start, end)

+

The initial value of the @@slice property is the same function object as the initial value of the SharedArrayBuffer.prototype.slice property.

+
+
+ + +

7 Left-Hand-Side Expressions

+

Syntax

+ + MemberExpression[Yield, Await]:PrimaryExpression[?Yield, ?Await] + MemberExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + MemberExpression[?Yield, ?Await].IdentifierName + MemberExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await] + SuperProperty[?Yield, ?Await] + MetaProperty + newMemberExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + MemberExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]opt:Expression[+In, ?Yield, ?Await]opt] + + + + CallExpression[Yield, Await]:CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] + SuperCall[?Yield, ?Await] + ImportCall[?Yield, ?Await] + CallExpression[?Yield, ?Await]Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] + CallExpression[?Yield, ?Await].IdentifierName + CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged] + CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]opt:Expression[+In, ?Yield, ?Await]opt] + + + +

7.1 Static Semantics: AssignmentTargetType

+ + + MemberExpression:MemberExpression[Expressionopt:Expressionopt] + + + CallExpression:CallExpression[Expressionopt:Expressionopt] + +
  1. Return invalid.
+
+ + +

7.2 Runtime Semantics: Evaluation

+ + MemberExpression:MemberExpression[Expressionopt:Expressionopt] + +
  1. Let fromReference be the result of evaluating MemberExpression.
  2. Let fromValue be ? GetValue(fromeference).
  3. If the first Expression is present, then
    1. Let startRef be the result of evaluating the first Expression.
    2. Let start be ? GetValue(startRef).
  4. Else,
    1. Let start be 0.
  5. If the second Expression is present, then
    1. Let endRef be the result of evaluating the second Expression.
    2. Let end be ? GetValue(endRef).
  6. Else,
    1. Let end be undefined.
  7. Let from be ? ToObject(fromValue).
  8. Let method be ? GetMethod(from, @@slice).
  9. Return ? Call(method, from, « start, end »).
+ + + CallExpression:CallExpression[Expressionopt:Expressionopt] + +
  1. Let fromReference be the result of evaluating CallExpression.
  2. Let fromValue be ? GetValue(fromeference).
  3. If the first Expression is present, then
    1. Let startRef be the result of evaluating the first Expression.
    2. Let start be ? GetValue(startRef).
  4. Else,
    1. Let start be 0.
  5. If the second Expression is present, then
    1. Let endRef be the result of evaluating the second Expression.
    2. Let end be ? GetValue(endRef).
  6. Else,
    1. Let end be undefined.
  7. Let from be ? ToObject(fromValue).
  8. Let method be ? GetMethod(from, @@slice).
  9. Return ? Call(method, from, « start, end »).
+
+
+
\ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..f7898ba --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "private": true, + "name": "proposals-slice-notation", + "description": "A proposal to add slice notation to ECMAScript", + "scripts": { + "build": "ecmarkup spec.emu index.html" + }, + "homepage": "https://github.com/tc39/proposal-slice-notationt#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/tc39/proposal-slice-notation.git" + }, + "license": "MIT", + "devDependencies": { + "ecmarkup": "^3.11.5" + } +} diff --git a/spec.emu b/spec.emu new file mode 100644 index 0000000..60f6425 --- /dev/null +++ b/spec.emu @@ -0,0 +1,167 @@ +
+  title: Slice notation
+  status: proposal
+  stage: 1
+  location: https://github.com/tc39/proposal-slice-notation
+  copyright: false
+  contributors: Sathya Gunasekaran
+
+ + +

Well-Known Symbols

+

Well-known symbols are built-in Symbol values that are explicitly referenced by algorithms of this specification. They are typically used as the keys of properties whose values serve as extension points of a specification algorithm. Unless otherwise specified, well-known symbols values are shared by all realms ().

+

Within this specification a well-known symbol is referred to by using a notation of the form @@name, where “name” is one of the values listed in .

+ + + + + + + + + + + + + + +
+ Specification Name + + [[Description]] + + Value and Purpose +
+ @@slice + + *"Symbol.slice"* + + A method that slices the receiver based on a start and end index. +
+
+
+ + +

Properties of the Symbol Constructor

+ +

Symbol.slice

+

The initial value of `Symbol.slice` is the well known symbol @@slice ().

+

This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

+
+
+ + +

Properties of the Array Prototype

+ +

Array.prototype [ @@slice ] (start, end)

+

The initial value of the @@slice property is the same function object as the initial value of the `Array.prototype.slice` property.

+
+
+ + +

Properties of the %TypedArray.prototype% Object

+ +

%TypedArray%.prototype [ @@slice ] (start, end)

+

The initial value of the @@slice property is the same function object as the initial value of the `%TypedArray%.prototype.slice` property.

+
+
+ + +

Properties of the ArrayBuffer Prototype Object

+ +

ArrayBuffer.prototype [ @@slice ] (start, end)

+

The initial value of the @@slice property is the same function object as the initial value of the `ArrayBuffer.prototype.slice` property.

+
+
+ + +

Properties of the SharedArrayBuffer Prototype Object

+ +

SharedArrayBuffer.prototype [ @@slice ] (start, end)

+

The initial value of the @@slice property is the same function object as the initial value of the `SharedArrayBuffer.prototype.slice` property.

+
+
+ + +

Left-Hand-Side Expressions

+

Syntax

+ + MemberExpression[Yield, Await] : + PrimaryExpression[?Yield, ?Await] + MemberExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await] `]` + MemberExpression[?Yield, ?Await] `.` IdentifierName + MemberExpression[?Yield, ?Await] TemplateLiteral[?Yield, ?Await] + SuperProperty[?Yield, ?Await] + MetaProperty + `new` MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await] + MemberExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await]? `:` Expression[+In, ?Yield, ?Await]? `]` + + + + CallExpression[Yield, Await] : + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] #callcover + SuperCall[?Yield, ?Await] + ImportCall[?Yield, ?Await] + CallExpression[?Yield, ?Await] Arguments[?Yield, ?Await] + CallExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await] `]` + CallExpression[?Yield, ?Await] `.` IdentifierName + CallExpression[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged] + CallExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await]? `:` Expression[+In, ?Yield, ?Await]? `]` + + + +

Static Semantics: AssignmentTargetType

+ + + MemberExpression : + MemberExpression `[` Expression? `:` Expression? `]` + + CallExpression : + CallExpression `[` Expression? `:` Expression? `]` + + + 1. Return ~invalid~. + +
+ + +

Runtime Semantics: Evaluation

+ MemberExpression : MemberExpression `[` Expression? `:` Expression? `]` + + 1. Let _fromReference_ be the result of evaluating |MemberExpression|. + 1. Let _fromValue_ be ? GetValue(_fromeference_). + 1. If the first |Expression| is present, then + 1. Let _startRef_ be the result of evaluating the first |Expression|. + 1. Let _start_ be ? GetValue(_startRef_). + 1. Else, + 1. Let _start_ be 0. + 1. If the second |Expression| is present, then + 1. Let _endRef_ be the result of evaluating the second |Expression|. + 1. Let _end_ be ? GetValue(_endRef_). + 1. Else, + 1. Let _end_ be *undefined*. + 1. Let _from_ be ? ToObject(_fromValue_). + 1. Let _method_ be ? GetMethod(_from_, @@slice). + 1. Return ? Call(_method_, _from_, « _start_, _end_ »). + + + CallExpression : CallExpression `[` Expression? `:` Expression? `]` + + 1. Let _fromReference_ be the result of evaluating |CallExpression|. + 1. Let _fromValue_ be ? GetValue(_fromeference_). + 1. If the first |Expression| is present, then + 1. Let _startRef_ be the result of evaluating the first |Expression|. + 1. Let _start_ be ? GetValue(_startRef_). + 1. Else, + 1. Let _start_ be 0. + 1. If the second |Expression| is present, then + 1. Let _endRef_ be the result of evaluating the second |Expression|. + 1. Let _end_ be ? GetValue(_endRef_). + 1. Else, + 1. Let _end_ be *undefined*. + 1. Let _from_ be ? ToObject(_fromValue_). + 1. Let _method_ be ? GetMethod(_from_, @@slice). + 1. Return ? Call(_method_, _from_, « _start_, _end_ »). + +
+
From c4fd41f0182eb1d453565f331860f07abc830a6d Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Wed, 24 Jun 2020 08:05:22 +0100 Subject: [PATCH 2/5] Use AssignmentExpression Co-authored-by: Leo Balter --- spec.emu | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/spec.emu b/spec.emu index 60f6425..e8191e3 100644 --- a/spec.emu +++ b/spec.emu @@ -94,7 +94,7 @@ SuperProperty[?Yield, ?Await] MetaProperty `new` MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await] - MemberExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await]? `:` Expression[+In, ?Yield, ?Await]? `]` + MemberExpression[?Yield, ?Await] `[` AssignmentExpression[+In, ?Yield, ?Await]? `:` AssignmentExpression[+In, ?Yield, ?Await]? `]` @@ -106,7 +106,7 @@ CallExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await] `]` CallExpression[?Yield, ?Await] `.` IdentifierName CallExpression[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged] - CallExpression[?Yield, ?Await] `[` Expression[+In, ?Yield, ?Await]? `:` Expression[+In, ?Yield, ?Await]? `]` + CallExpression[?Yield, ?Await] `[` AssignmentExpression[+In, ?Yield, ?Await]? `:` AssignmentExpression[+In, ?Yield, ?Await]? `]` @@ -114,10 +114,10 @@ MemberExpression : - MemberExpression `[` Expression? `:` Expression? `]` + MemberExpression `[` AssignmentExpression? `:` AssignmentExpression? `]` CallExpression : - CallExpression `[` Expression? `:` Expression? `]` + CallExpression `[` AssignmentExpression? `:` AssignmentExpression? `]` 1. Return ~invalid~. @@ -126,42 +126,42 @@

Runtime Semantics: Evaluation

- MemberExpression : MemberExpression `[` Expression? `:` Expression? `]` + MemberExpression : MemberExpression `[` AssignmentExpression? `:` AssignmentExpression? `]` 1. Let _fromReference_ be the result of evaluating |MemberExpression|. 1. Let _fromValue_ be ? GetValue(_fromeference_). - 1. If the first |Expression| is present, then - 1. Let _startRef_ be the result of evaluating the first |Expression|. + 1. If the first |AssignmentExpression| is present, then + 1. Let _startRef_ be the result of evaluating the first |AssignmentExpression|. 1. Let _start_ be ? GetValue(_startRef_). 1. Else, 1. Let _start_ be 0. - 1. If the second |Expression| is present, then - 1. Let _endRef_ be the result of evaluating the second |Expression|. + 1. If the second |AssignmentExpression| is present, then + 1. Let _endRef_ be the result of evaluating the second |AssignmentExpression|. 1. Let _end_ be ? GetValue(_endRef_). 1. Else, 1. Let _end_ be *undefined*. 1. Let _from_ be ? ToObject(_fromValue_). 1. Let _method_ be ? GetMethod(_from_, @@slice). - 1. Return ? Call(_method_, _from_, « _start_, _end_ »). + 1. Return ? Call(_method_, _from_, « _start_, _end_ »). - CallExpression : CallExpression `[` Expression? `:` Expression? `]` + CallExpression : CallExpression `[` AssignmentExpression? `:` AssignmentExpression? `]` 1. Let _fromReference_ be the result of evaluating |CallExpression|. 1. Let _fromValue_ be ? GetValue(_fromeference_). - 1. If the first |Expression| is present, then - 1. Let _startRef_ be the result of evaluating the first |Expression|. + 1. If the first |AssignmentExpression| is present, then + 1. Let _startRef_ be the result of evaluating the first |AssignmentExpression|. 1. Let _start_ be ? GetValue(_startRef_). 1. Else, 1. Let _start_ be 0. - 1. If the second |Expression| is present, then - 1. Let _endRef_ be the result of evaluating the second |Expression|. + 1. If the second |AssignmentExpression| is present, then + 1. Let _endRef_ be the result of evaluating the second |AssignmentExpression|. 1. Let _end_ be ? GetValue(_endRef_). 1. Else, 1. Let _end_ be *undefined*. 1. Let _from_ be ? ToObject(_fromValue_). 1. Let _method_ be ? GetMethod(_from_, @@slice). - 1. Return ? Call(_method_, _from_, « _start_, _end_ »). + 1. Return ? Call(_method_, _from_, « _start_, _end_ »).
From a1216814615aaf1026ece03e69a8f8cd09807d2d Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Wed, 24 Jun 2020 08:06:10 +0100 Subject: [PATCH 3/5] Fix typo Change _fromeference_ to _fromReference_ Co-authored-by: Ron Buckton --- spec.emu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.emu b/spec.emu index e8191e3..a96315b 100644 --- a/spec.emu +++ b/spec.emu @@ -129,7 +129,7 @@ MemberExpression : MemberExpression `[` AssignmentExpression? `:` AssignmentExpression? `]` 1. Let _fromReference_ be the result of evaluating |MemberExpression|. - 1. Let _fromValue_ be ? GetValue(_fromeference_). + 1. Let _fromValue_ be ? GetValue(_fromReference_). 1. If the first |AssignmentExpression| is present, then 1. Let _startRef_ be the result of evaluating the first |AssignmentExpression|. 1. Let _start_ be ? GetValue(_startRef_). @@ -148,7 +148,7 @@ CallExpression : CallExpression `[` AssignmentExpression? `:` AssignmentExpression? `]` 1. Let _fromReference_ be the result of evaluating |CallExpression|. - 1. Let _fromValue_ be ? GetValue(_fromeference_). + 1. Let _fromValue_ be ? GetValue(_fromReference_). 1. If the first |AssignmentExpression| is present, then 1. Let _startRef_ be the result of evaluating the first |AssignmentExpression|. 1. Let _start_ be ? GetValue(_startRef_). From 8edf6910b0850782ad6c38cbdb827492ed722327 Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Wed, 24 Jun 2020 08:28:49 +0100 Subject: [PATCH 4/5] Update spec text --- index.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 0abef7e..c3fab6b 100644 --- a/index.html +++ b/index.html @@ -1841,7 +1841,7 @@ display: none; } } -

Stage 1 Draft / June 23, 2020

Slice notation

+

Stage 1 Draft / June 24, 2020

Slice notation

1 Well-Known Symbols

@@ -1929,7 +1929,7 @@

Syntax

SuperProperty[?Yield, ?Await] MetaProperty newMemberExpression[?Yield, ?Await]Arguments[?Yield, ?Await] - MemberExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]opt:Expression[+In, ?Yield, ?Await]opt] + MemberExpression[?Yield, ?Await][AssignmentExpression[+In, ?Yield, ?Await]opt:AssignmentExpression[+In, ?Yield, ?Await]opt] @@ -1940,17 +1940,17 @@

Syntax

CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]] CallExpression[?Yield, ?Await].IdentifierName CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged] - CallExpression[?Yield, ?Await][Expression[+In, ?Yield, ?Await]opt:Expression[+In, ?Yield, ?Await]opt] + CallExpression[?Yield, ?Await][AssignmentExpression[+In, ?Yield, ?Await]opt:AssignmentExpression[+In, ?Yield, ?Await]opt]

7.1 Static Semantics: AssignmentTargetType

- MemberExpression:MemberExpression[Expressionopt:Expressionopt] + MemberExpression:MemberExpression[AssignmentExpressionopt:AssignmentExpressionopt] - CallExpression:CallExpression[Expressionopt:Expressionopt] + CallExpression:CallExpression[AssignmentExpressionopt:AssignmentExpressionopt]
  1. Return invalid.
@@ -1958,14 +1958,14 @@

Syntax

7.2 Runtime Semantics: Evaluation

- MemberExpression:MemberExpression[Expressionopt:Expressionopt] + MemberExpression:MemberExpression[AssignmentExpressionopt:AssignmentExpressionopt] -
  1. Let fromReference be the result of evaluating MemberExpression.
  2. Let fromValue be ? GetValue(fromeference).
  3. If the first Expression is present, then
    1. Let startRef be the result of evaluating the first Expression.
    2. Let start be ? GetValue(startRef).
  4. Else,
    1. Let start be 0.
  5. If the second Expression is present, then
    1. Let endRef be the result of evaluating the second Expression.
    2. Let end be ? GetValue(endRef).
  6. Else,
    1. Let end be undefined.
  7. Let from be ? ToObject(fromValue).
  8. Let method be ? GetMethod(from, @@slice).
  9. Return ? Call(method, from, « start, end »).
+
  1. Let fromReference be the result of evaluating MemberExpression.
  2. Let fromValue be ? GetValue(fromReference).
  3. If the first AssignmentExpression is present, then
    1. Let startRef be the result of evaluating the first AssignmentExpression.
    2. Let start be ? GetValue(startRef).
  4. Else,
    1. Let start be 0.
  5. If the second AssignmentExpression is present, then
    1. Let endRef be the result of evaluating the second AssignmentExpression.
    2. Let end be ? GetValue(endRef).
  6. Else,
    1. Let end be undefined.
  7. Let from be ? ToObject(fromValue).
  8. Let method be ? GetMethod(from, @@slice).
  9. Return ? Call(method, from, « start, end »).
- CallExpression:CallExpression[Expressionopt:Expressionopt] + CallExpression:CallExpression[AssignmentExpressionopt:AssignmentExpressionopt] -
  1. Let fromReference be the result of evaluating CallExpression.
  2. Let fromValue be ? GetValue(fromeference).
  3. If the first Expression is present, then
    1. Let startRef be the result of evaluating the first Expression.
    2. Let start be ? GetValue(startRef).
  4. Else,
    1. Let start be 0.
  5. If the second Expression is present, then
    1. Let endRef be the result of evaluating the second Expression.
    2. Let end be ? GetValue(endRef).
  6. Else,
    1. Let end be undefined.
  7. Let from be ? ToObject(fromValue).
  8. Let method be ? GetMethod(from, @@slice).
  9. Return ? Call(method, from, « start, end »).
+
  1. Let fromReference be the result of evaluating CallExpression.
  2. Let fromValue be ? GetValue(fromReference).
  3. If the first AssignmentExpression is present, then
    1. Let startRef be the result of evaluating the first AssignmentExpression.
    2. Let start be ? GetValue(startRef).
  4. Else,
    1. Let start be 0.
  5. If the second AssignmentExpression is present, then
    1. Let endRef be the result of evaluating the second AssignmentExpression.
    2. Let end be ? GetValue(endRef).
  6. Else,
    1. Let end be undefined.
  7. Let from be ? ToObject(fromValue).
  8. Let method be ? GetMethod(from, @@slice).
  9. Return ? Call(method, from, « start, end »).
\ No newline at end of file From bfa2dd3a9831cb639a475e8c706893956caabea4 Mon Sep 17 00:00:00 2001 From: Sathya Gunasekaran Date: Wed, 24 Jun 2020 09:14:13 +0100 Subject: [PATCH 5/5] Add optional chaining integration and refactor --- index.html | 83 +++++++++++++++++++++++++++---------- spec.emu | 117 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 142 insertions(+), 58 deletions(-) diff --git a/index.html b/index.html index c3fab6b..52ad67b 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ -Slice notation