From 4a0ec571dd5d00f5cfd8cf4abdb7f220381fa8e4 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 30 Jan 2023 14:33:44 -0500 Subject: [PATCH 1/2] Move BindingPattern restriction for 'using' to an early error --- spec.emu | 53 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/spec.emu b/spec.emu index 4edda37..56fde51 100644 --- a/spec.emu +++ b/spec.emu @@ -2101,7 +2101,7 @@ contributors: Ron Buckton, Ecma International

Syntax

LexicalDeclaration[In, Yield, Await] : - LetOrConst BindingList[?In, ?Yield, ?Await, ~Using] `;` + LetOrConst BindingList[?In, ?Yield, ?Await] `;` UsingDeclaration[?In, ?Yield, ?Await] LetOrConst : @@ -2110,17 +2110,16 @@ contributors: Ron Buckton, Ecma International UsingDeclaration[In, Yield, Await] : - `using` [no LineTerminator here] [lookahead != `await`] BindingList[?In, ?Yield, ?Await, +Using] `;` + `using` [no LineTerminator here] [lookahead != `await`] BindingList[?In, ?Yield, ?Await] `;` - BindingList[In, Yield, Await, Using] : - LexicalBinding[?In, ?Yield, ?Await, ?Using] - BindingList[?In, ?Yield, ?Await, ?Using] `,` LexicalBinding[?In, ?Yield, ?Await, ?Using] + BindingList[In, Yield, Await] : + LexicalBinding[?In, ?Yield, ?Await] + BindingList[?In, ?Yield, ?Await] `,` LexicalBinding[?In, ?Yield, ?Await] - LexicalBinding[In, Yield, Await, Using] : + LexicalBinding[In, Yield, Await] : BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]? - BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await] - [~Using] BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await] + BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await] @@ -2155,6 +2154,14 @@ contributors: Ron Buckton, Ecma International + + LexicalBinding : BindingPattern Initializer + + @@ -2448,25 +2455,37 @@ contributors: Ron Buckton, Ecma International ForInOfStatement[Yield, Await, Return] : `for` `(` [lookahead != `let` `[`] LeftHandSideExpression[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - `for` `(` `var` ForBinding[?Yield, ?Await, ~Using] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - `for` `(` ForDeclaration[?Yield, ?Await, ~Using] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + `for` `(` `var` ForBinding[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + `for` `(` ForDeclaration[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` [lookahead ∉ {`let`, `async` `of`}] LeftHandSideExpression[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - `for` `(` `var` ForBinding[?Yield, ?Await, ~Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + `for` `(` `var` ForBinding[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` [lookahead != `using` `of`] ForDeclaration[?Yield, ?Await, +Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] [+Await] `for` `await` `(` [lookahead != `let`] LeftHandSideExpression[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - [+Await] `for` `await` `(` `var` ForBinding[?Yield, ?Await, ~Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + [+Await] `for` `await` `(` `var` ForBinding[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] [+Await] `for` `await` `(` [lookahead != `using` `of`] ForDeclaration[?Yield, ?Await, +Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] ForDeclaration[Yield, Await, Using] : - LetOrConst ForBinding[?Yield, ?Await, ~Using] - [+Using] `using` [no LineTerminator here] [lookahead != `await`] ForBinding[?Yield, ?Await, +Using] + LetOrConst ForBinding[?Yield, ?Await] + [+Using] `using` [no LineTerminator here] [lookahead != `await`] ForBinding[?Yield, ?Await] - ForBinding[Yield, Await, Using] : + ForBinding[Yield, Await] : BindingIdentifier[?Yield, ?Await] - BindingPattern[?Yield, ?Await] - [~Using] BindingPattern[?Yield, ?Await] + BindingPattern[?Yield, ?Await] + +

Static Semantics: Early Errors

+ + + ForBinding : BindingPattern +
    +
  • + It is a Syntax Error if this |ForBinding| is contained in a |ForDeclaration| and IsUsingDeclaration of that |ForDeclaration| is *true*. +
  • +
+
+
+

Runtime Semantics: ForDeclarationBindingInstantiation ( From 15136771959fdf06336f6787e390a3b2852b2b33 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 30 Jan 2023 14:45:05 -0500 Subject: [PATCH 2/2] fix typo and restore missing parameter --- spec.emu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.emu b/spec.emu index 56fde51..b6fe145 100644 --- a/spec.emu +++ b/spec.emu @@ -2456,7 +2456,7 @@ contributors: Ron Buckton, Ecma International ForInOfStatement[Yield, Await, Return] : `for` `(` [lookahead != `let` `[`] LeftHandSideExpression[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` `var` ForBinding[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] - `for` `(` ForDeclaration[?Yield, ?Await] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] + `for` `(` ForDeclaration[?Yield, ?Await, ~Using] `in` Expression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` [lookahead ∉ {`let`, `async` `of`}] LeftHandSideExpression[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` `var` ForBinding[?Yield, ?Await] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] `for` `(` [lookahead != `using` `of`] ForDeclaration[?Yield, ?Await, +Using] `of` AssignmentExpression[+In, ?Yield, ?Await] `)` Statement[?Yield, ?Await, ?Return] @@ -2480,7 +2480,7 @@ contributors: Ron Buckton, Ecma International ForBinding : BindingPattern
  • - It is a Syntax Error if this |ForBinding| is contained in a |ForDeclaration| and IsUsingDeclaration of that |ForDeclaration| is *true*. + It is a Syntax Error if this |ForBinding| is contained within a |ForDeclaration| and IsUsingDeclaration of that |ForDeclaration| is *true*.