From be3842bdea123594aed4c330d9ce0e10dc6579a7 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 8 May 2018 16:09:30 -0700 Subject: [PATCH 1/3] Require decorators before 'export' keyword --- spec.html | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/spec.html b/spec.html index b3bc0a8..7ff7dee 100644 --- a/spec.html +++ b/spec.html @@ -130,9 +130,10 @@

Updated Productions

`export` ExportClause FromClause `;` `export` ExportClause `;` `export` VariableStatement[~Yield, ~Await] - `export` Declaration[~Yield, ~Await] + `export` [lookahead <! {`@`}] Declaration[~Yield, ~Await] + DecoratorList[~Yield, ~Await] `export` [lookahead <! {`@`}] ClassDeclaration[~Yield, ~Await, ~Default] `export` `default` HoistableDeclaration[~Yield, ~Await, +Default] - `export` `default` ClassDeclaration[~Yield, ~Await, +Default] + DecoratorList[~Yield, ~Await]? `export` `default` [lookahead <! {`@`}] ClassDeclaration[~Yield, ~Await, +Default] `export` `default` [lookahead <! {`function`, `async` [no |LineTerminator| here] `function`, `class`, `@`}] AssignmentExpression[+In, ~Yield, ~Await] `;` @@ -194,10 +195,10 @@

The ElementDescriptor Specification Type

- +

Modified class algorithms

- +

Runtime Semantics: ClassDefinitionEvaluation

With parameters _className_ and _decorators_.

ClassTail : ClassHeritage? `{` ClassBody? `}` @@ -316,14 +317,13 @@

Runtime Semantics: ClassElementEvaluation

- +

Runtime Semantics: BindingClassDeclarationEvaluation

+

With parameter _decorators_.

ClassDeclaration : DecoratorList? `class` BindingIdentifier ClassTail - 1. If |DecoratorList_opt| is present, let _decorators_ be the result of performing DecoratorListEvaluation of |DecoratorList|. - 1. Otherwise, let _decorators_ be a new empty List. 1. Let _className_ be StringValue of |BindingIdentifier|. - 1. Let _value_ be the result of ClassDefinitionEvaluation of |ClassTail| with arguments _className_ and _decorators. + 1. Let _value_ be the result of ClassDefinitionEvaluation of |ClassTail| with arguments _className_ and _decorators_. 1. ReturnIfAbrupt(_value_). 1. Let _hasNameProperty_ be ? HasOwnProperty(_value_, `"name"`). 1. If _hasNameProperty_ is *false*, perform SetFunctionName(_value_, _className_). @@ -331,10 +331,8 @@

Runtime Semantics: BindingClassDeclarationEvaluation

1. Perform ? InitializeBoundName(_className_, _value_, _env_). 1. Return _value_.
- ClassDeclaration : DecoratorList? `class` ClassTail + ClassDeclaration : `class` ClassTail - 1. If |DecoratorList| is present, let _decorators_ be the result of performing DecoratorListEvaluation of |DecoratorList|. - 1. Otherwise, let _decorators_ be a new empty List. 1. Return the result of ClassDefinitionEvaluation of |ClassTail| with arguments *undefined* and _decorators_. @@ -347,7 +345,9 @@

Runtime Semantics: BindingClassDeclarationEvaluation

Runtime Semantics: Evaluation

ClassDeclaration : DecoratorList? `class` BindingIdentifier ClassTail - 1. Perform ? BindingClassDeclarationEvaluation of this |ClassDeclaration|. + 1. If |DecoratorList_opt| is present, let _decorators_ be the result of DecoratorListEvaluation of |DecoratorList|. + 1. Otherwise, let _decorators_ be a new empty List. + 1. Perform ? BindingClassDeclarationEvaluation of this |ClassDeclaration| with argument _decorators_. 1. Return NormalCompletion(~empty~). @@ -355,7 +355,7 @@

Runtime Semantics: Evaluation

ClassExpression : DecoratorList? `class` BindingIdentifier? ClassTail - 1. If |DecoratorList_opt| is present, let _decorators_ be the result of performing DecoratorListEvaluation of |DecoratorList|. + 1. If |DecoratorList_opt| is present, let _decorators_ be the result of DecoratorListEvaluation of |DecoratorList|. 1. Otherwise, let _decorators_ be a new empty List. 1. If |BindingIdentifier_opt| is not present, let _className_ be *undefined*. 1. Else, let _className_ be StringValue of |BindingIdentifier|. @@ -410,6 +410,31 @@

CoalesceClassElements ( _elements_ )

+ +

Modified Exports algorithms

+ +

Runtime Semantics: Evaluation

+ ExportDeclaration: DecoratorList `export` ClassDeclaration + + 1. Let _decorators_ be the result of DecoratorListEvaluation of |DecoratorList|. + 1. Perform ? BindingClassDeclarationEvaluation of |ClassDeclaration| with parameter _decorators_. + 1. Return NormalCompletion(~empty~). + + ExportDeclaration: DecoratorList? `export` `default` ClassDeclaration + + 1. Let _decorators_ be the result of DecoratorListEvaluation of |DecoratorList_opt|. + 1. Let _value_ be the result of BindingClassDeclarationEvaluation of |ClassDeclaration| with parameter _decorators_. + 1. ReturnIfAbrupt(_value_) + 1. Let _className_ be the sole element of BoundNames of |ClassDeclaration|. + 1. If _className_ is `"*default*"`, then + 1. Let _hasNameProperty_ be ? HasOwnProperty(_value_, `"name"`). + 1. If _hasNameProperty_ is *false*, perform SetFunctionName(_value_, `"default"`). + 1. Let _env_ be the running execution context's LexicalEnvironment. + 1. Perform ? InitializeBoundName(`"*default*"`, _value_, _env_). + 1. Return NormalCompletion(~empty~). + +
+
From dd1123ffea507c29ace2b974f3ddfca13084968b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 10 May 2018 14:46:19 -0700 Subject: [PATCH 2/3] Add 'Decorators' production param --- spec.html | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/spec.html b/spec.html index 7ff7dee..4122dac 100644 --- a/spec.html +++ b/spec.html @@ -112,15 +112,26 @@

New Productions

Updated Productions

+ StatementListItem[Yield, Await, Return] : + Statement[?Yield, ?Await, ?Return] + Declaration[?Yield, ?Await, +Decorators] + + Declaration[Yield, Await, Decorators] : + HoistableDeclaration[?Yield, ?Await, ~Default] + ClassDeclaration[?Yield, ?Await, ~Default, ?Decorators] + LexicalDeclaration[+In, ?Yield, ?Await] + ClassElement[Yield, Await] : DecoratorList[?Yield, ?Await]? MethodDefinition[?Yield, ?Await] DecoratorList[?Yield, ?Await]? `static` MethodDefinition[?Yield, ?Await] DecoratorList[?Yield, ?Await]? FieldDefinition[?Yield, ?Await] `;` DecoratorList[?Yield, ?Await]? `static` FieldDefinition[?Yield, ?Await] `;` - ClassDeclaration[Yield, Await, Default] : - DecoratorList[?Yield, ?Await]? `class` BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await] - [+Default] DecoratorList[?Yield, ?Await]? `class` ClassTail[?Yield, ?Await] + ClassDeclaration[Yield, Await, Default, Decorators] : + `class` BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await] + [+Default] `class` ClassTail[?Yield, ?Await] + [+Decorators] DecoratorList[?Yield, ?Await] `class` BindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await] + [+Decorators, +Default] DecoratorList[?Yield, ?Await] `class` ClassTail[?Yield, ?Await] ClassExpression[Yield, Await] : DecoratorList[?Yield, ?Await]? `class` BindingIdentifier[?Yield, ?Await]? ClassTail[?Yield, ?Await] @@ -130,11 +141,11 @@

Updated Productions

`export` ExportClause FromClause `;` `export` ExportClause `;` `export` VariableStatement[~Yield, ~Await] - `export` [lookahead <! {`@`}] Declaration[~Yield, ~Await] - DecoratorList[~Yield, ~Await] `export` [lookahead <! {`@`}] ClassDeclaration[~Yield, ~Await, ~Default] + `export` Declaration[~Yield, ~Await, ~Decorators] `export` `default` HoistableDeclaration[~Yield, ~Await, +Default] - DecoratorList[~Yield, ~Await]? `export` `default` [lookahead <! {`@`}] ClassDeclaration[~Yield, ~Await, +Default] `export` `default` [lookahead <! {`function`, `async` [no |LineTerminator| here] `function`, `class`, `@`}] AssignmentExpression[+In, ~Yield, ~Await] `;` + DecoratorList[~Yield, ~Await] `export` ClassDeclaration[~Yield, ~Await, ~Default, ~Decorators] + DecoratorList[~Yield, ~Await] `export` `default` ClassDeclaration[~Yield, ~Await, +Default, ~Decorators]
From 42c470fba9a91c8e2e5962139e10f4c5ac7d4406 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 11 May 2018 17:32:13 -0700 Subject: [PATCH 3/3] Update minimum version of ecmarkup --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fdb6c3a..807446c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "license": "SEE LICENSE IN https://tc39.github.io/ecma262/#sec-copyright-and-software-license", "homepage": "https://tc39.github.io/proposal-decorators/", "dependencies": { - "ecmarkup": "^3.12.0" + "ecmarkup": "^3.14.0" }, "devDependencies": { "@alrra/travis-scripts": "^3.0.0"