From d2faa6128850b575057f727075256d0b95d5322f Mon Sep 17 00:00:00 2001 From: Dan Ehrenberg Date: Mon, 25 Jul 2016 17:37:38 -0700 Subject: [PATCH] Ban new.target and arguments from initializers --- spec/new-productions.htm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/new-productions.htm b/spec/new-productions.htm index c9ea6a5..5b9e30e 100644 --- a/spec/new-productions.htm +++ b/spec/new-productions.htm @@ -9,6 +9,18 @@

|PublicFieldDefinition|

+ +

Static Semantics: Early Errors

+ PublicFieldDefinition : + PropertyName[?Yield] Initializer? + + + + 1. It is a SyntaxError if |Initializer| contains |NewTarget|. + 1. It is a SyntaxError if |Initializer| contains an |Identifier| with the StringValue `"arguments"`. + +
+

Static Semantics: ClassPublicFields

@@ -101,6 +113,8 @@

InitializePublicInstanceFields ( _O_, _constructor_ )

1. Assert: Assert _constructor_ is an ECMAScript function object. 1. Let _lex_ be the Lexical Environment of the running execution context. 1. Let _initializerEnv_ be NewFunctionEnvironment ( _constructor_, *undefined* ). + 1. Perform ! _envRec_.CreateImmutableBinding(`"arguments"`, ~false~). + 1. Perform ! _envRec_.InitializeBinding(`"arguments"`, ~undefined~). 1. Let _initializerEnvRec_ be the value of _initializerEnv_'s EnvironmentRecord. 1. Perform _initializerER_.BindThisValue ( _O_ ). 1. Set the running execution context's LexicalEnvironment to _initializerEnv_.