6 | It is a Syntax Error if this |BreakStatement| is not nested, directly or indirectly (but not crossing function or `static` initialization block boundaries), within an |IterationStatement| or a |SwitchStatement|.
7 |
31 | It is a Syntax Error if the LexicallyDeclaredNames of |ClassStaticBlockStatementList| contains any duplicate entries.
32 |
33 |
34 | It is a Syntax Error if any element of the LexicallyDeclaredNames of |ClassStaticBlockStatementList| also occurs in the VarDeclaredNames of |ClassStaticBlockStatementList|.
35 |
36 |
37 | It is a Syntax Error if ContainsDuplicateLabels of |ClassStaticBlockStatementList| with argument « » is *true*.
38 |
39 |
40 | It is a Syntax Error if ContainsUndefinedBreakTarget of |ClassStaticBlockStatementList| with argument « » is *true*.
41 |
42 |
43 | It is a Syntax Error if ContainsUndefinedContinueTarget of |ClassStaticBlockStatementList| with arguments « » and « » is *true*.
44 |
45 |
46 | It is a Syntax Error if ContainsArguments of |ClassStaticBlockStatementList| is *true*.
47 |
48 |
49 | It is a Syntax Error if |ClassStaticBlockStatementList| Contains |SuperCall| is *true*.
50 |
51 |
52 | It is a Syntax Error if ContainsAwait of |ClassStaticBlockStatementList| is *true*.
53 |
Static semantic rules that depend upon substructure generally do not look into function definitions.
219 |
220 |
221 | ClassTail : ClassHeritage? `{` ClassBody `}`
222 |
223 | 1. If |ClassHeritage| is present, then
224 | 1. If ContainsAwait for |ClassHeritage| is *true*, return *true*.
225 | 1. Return the result of ComputedPropertyContainsAwait for |ClassBody|.
226 |
227 |
228 |
Static semantic rules that depend upon substructure generally do not look into class bodies except for |PropertyName|s.
329 | ClassStaticBlock : `static` `{` ClassStaticBlockBody `}`
330 |
331 | 1. Let _lex_ be the running execution context's LexicalEnvironment.
332 | 1. Let _privateScope_ be the running execution context's PrivateEnvironment.
333 | 1. Let _sourceText_ be the empty sequence of Unicode code points.
334 | 1. Let _formalParameters_ be an instance of the production FormalParameters : [empty].
335 | 1. Let _bodyFunction_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, _formalParameters_, |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateScope_).
336 | 1. Perform MakeMethod(_bodyFunction_, _homeObject_).
337 | 1. Return the ClassStaticBlockDefinition Record { [[BodyFunction]]: _bodyFunction_ }.
338 |
339 | The function created for _bodyFunction_ is never directly accessible to ECMAScript code.
340 |
341 |
342 |
343 |
344 |
For ease of specification, private methods and accessors are included alongside private fields in the [[PrivateElements]] slot of class instances. However, any given object has either all or none of the private methods and accessors defined by a given class. This feature has been designed so that implementations may choose to implement private methods and accessors using a strategy which does not require tracking each method or accessor individually.
397 |
For example, an implementation could directly associate instance private methods with their corresponding Private Name and track, for each object, which class constructors have run with that object as their `this` value. Looking up an instance private method on an object then consists of checking that the class constructor which defines the method has been used to initialize the object, then returning the method associated with the Private Name.
398 |
This differs from private fields: because field initializers can throw during class instantiation, an individual object may have some proper subset of the private fields of a given class, and so private fields must in general be tracked individually.
399 |
400 | ClassTail : ClassHeritage? `{` ClassBody? `}`
401 |
402 | 1. Let _env_ be the LexicalEnvironment of the running execution context.
403 | 1. Let _classScope_ be NewDeclarativeEnvironment(_env_).
404 | 1. If _classBinding_ is not *undefined*, then
405 | 1. Perform _classScope_.CreateImmutableBinding(_classBinding_, *true*).
406 | 1. Let _outerPrivateEnvironment_ be the running execution context's PrivateEnvironment.
407 | 1. Let _classPrivateEnvironment_ be NewPrivateEnvironment(_outerPrivateEnvironment_).
408 | 1. If |ClassBody_opt| is present, then
409 | 1. For each String _dn_ of the PrivateBoundIdentifiers of |ClassBody_opt|, do
410 | 1. If _classPrivateEnvironment_.[[Names]] contains a Private Name whose [[Description]] is _dn_, then
411 | 1. Assert: This is only possible for getter/setter pairs.
412 | 1. Else,
413 | 1. Let _name_ be a new Private Name whose [[Description]] value is _dn_.
414 | 1. Append _name_ to _classPrivateEnvironment_.[[Names]].
415 | 1. If |ClassHeritage_opt| is not present, then
416 | 1. Let _protoParent_ be %Object.prototype%.
417 | 1. Let _constructorParent_ be %Function.prototype%.
418 | 1. Else,
419 | 1. Set the running execution context's LexicalEnvironment to _classScope_.
420 | 1. NOTE: The running execution context's PrivateEnvironment is _outerPrivateEnvironment_ when evaluating |ClassHeritage|.
421 | 1. Let _superclassRef_ be the result of evaluating |ClassHeritage|.
422 | 1. Set the running execution context's LexicalEnvironment to _env_.
423 | 1. Let _superclass_ be ? GetValue(_superclassRef_).
424 | 1. If _superclass_ is *null*, then
425 | 1. Let _protoParent_ be *null*.
426 | 1. Let _constructorParent_ be %Function.prototype%.
427 | 1. Else if IsConstructor(_superclass_) is *false*, throw a *TypeError* exception.
428 | 1. Else,
429 | 1. Let _protoParent_ be ? Get(_superclass_, *"prototype"*).
430 | 1. If Type(_protoParent_) is neither Object nor Null, throw a *TypeError* exception.
431 | 1. Let _constructorParent_ be _superclass_.
432 | 1. Let _proto_ be ! OrdinaryObjectCreate(_protoParent_).
433 | 1. If |ClassBody_opt| is not present, let _constructor_ be ~empty~.
434 | 1. Else, let _constructor_ be ConstructorMethod of |ClassBody|.
435 | 1. Set the running execution context's LexicalEnvironment to _classScope_.
436 | 1. Set the running execution context's PrivateEnvironment to _classPrivateEnvironment_.
437 | 1. If _constructor_ is ~empty~, then
438 | 1. Let _steps_ be the algorithm steps defined in .
439 | 1. Let _F_ be ! CreateBuiltinFunction(_steps_, 0, _className_, « [[ConstructorKind]], [[SourceText]] », ~empty~, _constructorParent_).
440 | 1. Else,
441 | 1. Let _constructorInfo_ be ! DefineMethod of _constructor_ with arguments _proto_ and _constructorParent_.
442 | 1. Let _F_ be _constructorInfo_.[[Closure]].
443 | 1. Perform ! MakeClassConstructor(_F_).
444 | 1. Perform ! SetFunctionName(_F_, _className_).
445 | 1. Perform ! MakeConstructor(_F_, *false*, _proto_).
446 | 1. If |ClassHeritage_opt| is present, set _F_.[[ConstructorKind]] to ~derived~.
447 | 1. Perform ! CreateMethodProperty(_proto_, *"constructor"*, _F_).
448 | 1. If |ClassBody_opt| is not present, let _elements_ be a new empty List.
449 | 1. Else, let _elements_ be NonConstructorElements of |ClassBody|.
450 | 1. Let _instancePrivateMethods_ be a new empty List.
451 | 1. Let _staticPrivateMethods_ be a new empty List.
452 | 1. Let _instanceFields_ be a new empty List.
453 | 1. Let _staticFields__staticElements_ be a new empty List.
454 | 1. For each |ClassElement| _e_ of _elements_, do
455 | 1. If IsStatic of _e_ is *false*, then
456 | 1. Let _field__element_ be ClassElementEvaluation of _e_ with arguments _proto_ and *false*.
457 | 1. Else,
458 | 1. Let _field__element_ be ClassElementEvaluation of _e_ with arguments _F_ and *false*.
459 | 1. If _field__element_ is an abrupt completion, then
460 | 1. Set the running execution context's LexicalEnvironment to _lex_.
461 | 1. Set the running execution context's PrivateEnvironment to _outerPrivateEnvironment_.
462 | 1. Return Completion(_field__element_).
463 | 1. Set _field__element_ to _field__element_.[[Value]].
464 | 1. If _field__element_ is a PrivateElement, then
465 | 1. Assert: _field__element_.[[Kind]] is either ~method~ or ~accessor~.
466 | 1. If IsStatic of _e_ is *false*, let _container_ be _instancePrivateMethods_.
467 | 1. Else, let _container_ be _staticPrivateMethods_.
468 | 1. If _container_ contains a PrivateElement whose [[Key]] is _field__element_.[[Key]], then
469 | 1. Let _existing_ be that PrivateElement.
470 | 1. Assert: _field__element_.[[Kind]] and _existing_.[[Kind]] are both ~accessor~.
471 | 1. If _field__element_.[[Get]] is *undefined*, then
472 | 1. Let _combined_ be PrivateElement { [[Key]]: _field__element_.[[Key]], [[Kind]]: ~accessor~, [[Get]]: _existing_.[[Get]], [[Set]]: _field__element_.[[Set]] }.
473 | 1. Else,
474 | 1. Let _combined_ be PrivateElement { [[Key]]: _field__element_.[[Key]], [[Kind]]: ~accessor~, [[Get]]: _field__element_.[[Get]], [[Set]]: _existing_.[[Set]] }.
475 | 1. Replace _existing_ in _container_ with _combined_.
476 | 1. Else,
477 | 1. Append _field__element_ to _container_.
478 | 1. Else if _field__element_ is a ClassFieldDefinition Record, then
479 | 1. If IsStatic of _e_ is *false*, append _field__element_ to _instanceFields_.
480 | 1. Else, append _field__element_ to _staticFields__staticElements_.
481 | 1. If _element_ is a ClassStaticBlockDefinition Record, then
482 | 1. Append _element_ to _staticElements_.
483 | 1. Set the running execution context's LexicalEnvironment to _lex_.
484 | 1. If _classBinding_ is not *undefined*, then
485 | 1. Perform _classScopeEnvRec_.InitializeBinding(_classBinding_, _F_).
486 | 1. Set _F_.[[Fields]] to _instanceFields_.
487 | 1. For each PrivateElement _method_ of _staticPrivateMethods_, do
488 | 1. Perform ! PrivateMethodOrAccessorAdd(_method_, _F_).
489 | 1. For each element _fieldRecord__elementRecord_ of _staticFields__staticElements_, do
490 | 1. Let _result_ be DefineField(_F_, _fieldRecord_).
491 | 1. If _elementRecord_ is a ClassFieldDefinition Record, then
492 | 1. Let _result_ be DefineField(_F_, _elementRecord_).
493 | 1. Else,
494 | 1. Assert: _elementRecord_ is a ClassStaticBlockDefinition Record.
495 | 1. Let _result_ be EvaluateStaticBlock(_F_, _elementRecord_).
496 | 1. If _result_ is an abrupt completion, then
497 | 1. Set the running execution context's PrivateEnvironment to _outerPrivateEnvironment_.
498 | 1. Return _result_.
499 | 1. Set the running execution context's PrivateEnvironment to _outerPrivateEnvironment_.
500 | 1. Return _F_.
501 |
502 |
503 |
504 |
505 |
ClassDeclaration : `class` ClassTail only occurs as part of an |ExportDeclaration| and is never directly evaluated.
513 |
514 | ClassExpression : `class` ClassTail
515 |
516 | 1. Let _value_ be ? ClassDefinitionEvaluation of |ClassTail| with arguments *undefined* and *""*.
517 | 1. Set _value_.[[SourceText]] to the source text matched by |ClassExpression|.
518 | 1. Return _value_.
519 |
520 | ClassExpression : `class` BindingIdentifier ClassTail
521 |
522 | 1. Let _className_ be StringValue of |BindingIdentifier|.
523 | 1. Let _value_ be ? ClassDefinitionEvaluation of |ClassTail| with arguments _className_ and _className_.
524 | 1. Set _value_.[[SourceText]] to the source text matched by |ClassExpression|.
525 | 1. Return _value_.
526 |
527 | ClassElementName : PrivateIdentifier
528 |
529 | 1. Let _privateIdentifier_ be StringValue of |PrivateIdentifier|.
530 | 1. Let _privateEnvRec_ be the running execution context's PrivateEnvironment.
531 | 1. Let _names_ be _privateEnvRec_.[[Names]].
532 | 1. Assert: Exactly one element of _names_ is a Private Name whose [[Description]] is _privateIdentifier_.
533 | 1. Let _privateName_ be the Private Name in _names_ whose [[Description]] is _privateIdentifier_.
534 | 1. Return _privateName_.
535 |
536 |
537 | ClassStaticBlockStatementList : [empty]
538 |
539 | 1. Return NormalCompletion(*undefined*).
540 |
541 |
542 |
543 |
544 |
--------------------------------------------------------------------------------
/spec/sec-continue-statement-static-semantics-early-errors-patch.html:
--------------------------------------------------------------------------------
1 |
2 |
10 | It is a Syntax Error if this |ContinueStatement| is not nested, directly or indirectly (but not crossing function or `static` initialization block boundaries), within an |IterationStatement|.
11 |
The abstract operation EvaluateStaticBlock takes arguments _receiver_ (an Object) and _blockRecord_ (a ClassStaticBlockDefinition Record). It performs the following steps when called:
With parameters _functionObject_ and _argumentsList_ (a List).
4 | FunctionBody : FunctionStatementList
5 |
6 | 1. Return ? EvaluateFunctionBody of |FunctionBody| with arguments _functionObject_ and _argumentsList_.
7 |
8 | ConciseBody : ExpressionBody
9 |
10 | 1. Return ? EvaluateConciseBody of |ConciseBody| with arguments _functionObject_ and _argumentsList_.
11 |
12 | GeneratorBody : FunctionBody
13 |
14 | 1. Return ? EvaluateGeneratorBody of |GeneratorBody| with arguments _functionObject_ and _argumentsList_.
15 |
16 |
17 | AsyncGeneratorBody : FunctionBody
18 |
19 |
20 | 1. Return ? EvaluateAsyncGeneratorBody of |AsyncGeneratorBody| with arguments _functionObject_ and _argumentsList_.
21 |
22 |
23 | AsyncFunctionBody : FunctionBody
24 |
25 |
26 | 1. Return ? EvaluateAsyncFunctionBody of |AsyncFunctionBody| with arguments _functionObject_ and _argumentsList_.
27 |
28 |
29 | AsyncConciseBody : ExpressionBody
30 |
31 |
32 | 1. Return ? EvaluateAsyncConciseBody of |AsyncConciseBody| with arguments _functionObject_ and _argumentsList_.
33 |
34 |
35 | Initializer :
36 | `=` AssignmentExpression
37 |
38 |
39 | 1. Assert: _argumentsList_ is empty.
40 | 1. Assert: _functionObject_.[[ClassFieldInitializerName]] is not ~empty~.
41 | 1. If IsAnonymousFunctionDefinition(|AssignmentExpression|) is *true*, then
42 | 1. Let _value_ be NamedEvaluation of |Initializer| with argument _functionObject_.[[ClassFieldInitializerName]].
43 | 1. Else,
44 | 1. Let _rhs_ be the result of evaluating |AssignmentExpression|.
45 | 1. Let _value_ be ? GetValue(_rhs_).
46 | 1. Return Completion { [[Type]]: ~return~, [[Value]]: _value_, [[Target]]: ~empty~ }.
47 |
48 |
49 |
Even though field initializers constitute a function boundary, calling FunctionDeclarationInstantiation does not have any observable effect and so is omitted.
Static semantic rules that depend upon substructure generally do not look into function definitions.
47 |
48 | ClassTail : ClassHeritage? `{` ClassBody `}`
49 |
50 | 1. If _symbol_ is |ClassBody|, return *true*.
51 | 1. If _symbol_ is |ClassHeritage|, then
52 | 1. If |ClassHeritage| is present, return *true*; otherwise return *false*.
53 | 1. Let _inHeritage_ be |ClassHeritage| Contains _symbol_.
54 | 1. If _inHeritage_ is *true*, return *true*.
55 | 1. Return the result of ComputedPropertyContains for |ClassBody| with argument _symbol_.
56 |
57 |
58 |
Static semantic rules that depend upon substructure generally do not look into class bodies except for |PropertyName|s.
3 | StatementList : StatementList StatementListItem
4 |
5 | 1. Let _declarations_ be LexicallyScopedDeclarations of |StatementList|.
6 | 1. Append to _declarations_ the elements of the LexicallyScopedDeclarations of |StatementListItem|.
7 | 1. Return _declarations_.
8 |
9 | StatementListItem : Statement
10 |
11 | 1. If |Statement| is Statement : LabelledStatement , return LexicallyScopedDeclarations of |LabelledStatement|.
12 | 1. Return a new empty List.
13 |
14 | StatementListItem : Declaration
15 |
16 | 1. Return a List whose sole element is DeclarationPart of |Declaration|.
17 |
18 | CaseBlock : `{` `}`
19 |
20 | 1. Return a new empty List.
21 |
22 | CaseBlock : `{` CaseClauses? DefaultClause CaseClauses? `}`
23 |
24 | 1. If the first |CaseClauses| is present, let _declarations_ be the LexicallyScopedDeclarations of the first |CaseClauses|.
25 | 1. Else, let _declarations_ be a new empty List.
26 | 1. Append to _declarations_ the elements of the LexicallyScopedDeclarations of |DefaultClause|.
27 | 1. If the second |CaseClauses| is not present, return _declarations_.
28 | 1. Return the result of appending to _declarations_ the elements of the LexicallyScopedDeclarations of the second |CaseClauses|.
29 |
30 | CaseClauses : CaseClauses CaseClause
31 |
32 | 1. Let _declarations_ be LexicallyScopedDeclarations of |CaseClauses|.
33 | 1. Append to _declarations_ the elements of the LexicallyScopedDeclarations of |CaseClause|.
34 | 1. Return _declarations_.
35 |
36 | CaseClause : `case` Expression `:` StatementList?
37 |
38 | 1. If the |StatementList| is present, return the LexicallyScopedDeclarations of |StatementList|.
39 | 1. Return a new empty List.
40 |
41 | DefaultClause : `default` `:` StatementList?
42 |
43 | 1. If the |StatementList| is present, return the LexicallyScopedDeclarations of |StatementList|.
44 | 1. Return a new empty List.
45 |
46 | LabelledStatement : LabelIdentifier `:` LabelledItem
47 |
48 | 1. Return the LexicallyScopedDeclarations of |LabelledItem|.
49 |
50 | LabelledItem : Statement
51 |
52 | 1. Return a new empty List.
53 |
54 | LabelledItem : FunctionDeclaration
55 |
56 | 1. Return a List whose sole element is |FunctionDeclaration|.
57 |
58 | FunctionStatementList : [empty]
59 |
60 | 1. Return a new empty List.
61 |
62 | FunctionStatementList : StatementList
63 |
64 | 1. Return the TopLevelLexicallyScopedDeclarations of |StatementList|.
65 |
66 |
67 | ClassStaticBlockStatementList : [empty]
68 |
69 | 1. Return a new empty List.
70 |
71 | ClassStaticBlockStatementList : StatementList
72 |
73 | 1. Return the TopLevelLexicallyScopedDeclarations of |StatementList|.
74 |
75 |
76 | ConciseBody : ExpressionBody
77 |
78 | 1. Return a new empty List.
79 |
80 |
81 | AsyncConciseBody : ExpressionBody
82 |
83 |
84 | 1. Return a new empty List.
85 |
86 | ScriptBody : StatementList
87 |
88 | 1. Return TopLevelLexicallyScopedDeclarations of |StatementList|.
89 |
90 | Module : [empty]
91 |
92 | 1. Return a new empty List.
93 |
94 | ModuleItemList : ModuleItemList ModuleItem
95 |
96 | 1. Let _declarations_ be LexicallyScopedDeclarations of |ModuleItemList|.
97 | 1. Append to _declarations_ the elements of the LexicallyScopedDeclarations of |ModuleItem|.
98 | 1. Return _declarations_.
99 |
100 | ModuleItem : ImportDeclaration
101 |
102 | 1. Return a new empty List.
103 |
104 |
105 | ExportDeclaration :
106 | `export` ExportFromClause FromClause `;`
107 | `export` NamedExports `;`
108 | `export` VariableStatement
109 |
110 |
111 | 1. Return a new empty List.
112 |
113 | ExportDeclaration : `export` Declaration
114 |
115 | 1. Return a List whose sole element is DeclarationPart of |Declaration|.
116 |
117 | ExportDeclaration : `export` `default` HoistableDeclaration
118 |
119 | 1. Return a List whose sole element is DeclarationPart of |HoistableDeclaration|.
120 |
121 | ExportDeclaration : `export` `default` ClassDeclaration
122 |
123 | 1. Return a List whose sole element is |ClassDeclaration|.
124 |
125 | ExportDeclaration : `export` `default` AssignmentExpression `;`
126 |
127 | 1. Return a List whose sole element is this |ExportDeclaration|.
128 |
129 |
130 |
--------------------------------------------------------------------------------
/spec/sec-static-semantics-propname-patch.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Statement :
5 | EmptyStatement
6 | ExpressionStatement
7 | ContinueStatement
8 | BreakStatement
9 | ReturnStatement
10 | ThrowStatement
11 | DebuggerStatement
12 |
13 |
14 | 1. Return a new empty List.
15 |
16 | Block : `{` `}`
17 |
18 | 1. Return a new empty List.
19 |
20 | StatementList : StatementList StatementListItem
21 |
22 | 1. Let _names_ be VarDeclaredNames of |StatementList|.
23 | 1. Append to _names_ the elements of the VarDeclaredNames of |StatementListItem|.
24 | 1. Return _names_.
25 |
26 | StatementListItem : Declaration
27 |
28 | 1. Return a new empty List.
29 |
30 | VariableStatement : `var` VariableDeclarationList `;`
31 |
32 | 1. Return BoundNames of |VariableDeclarationList|.
33 |
34 | IfStatement : `if` `(` Expression `)` Statement `else` Statement
35 |
36 | 1. Let _names_ be VarDeclaredNames of the first |Statement|.
37 | 1. Append to _names_ the elements of the VarDeclaredNames of the second |Statement|.
38 | 1. Return _names_.
39 |
40 | IfStatement : `if` `(` Expression `)` Statement
41 |
42 | 1. Return the VarDeclaredNames of |Statement|.
43 |
44 | DoWhileStatement : `do` Statement `while` `(` Expression `)` `;`
45 |
46 | 1. Return the VarDeclaredNames of |Statement|.
47 |
48 | WhileStatement : `while` `(` Expression `)` Statement
49 |
50 | 1. Return the VarDeclaredNames of |Statement|.
51 |
52 | ForStatement : `for` `(` Expression? `;` Expression? `;` Expression? `)` Statement
53 |
54 | 1. Return the VarDeclaredNames of |Statement|.
55 |
56 | ForStatement : `for` `(` `var` VariableDeclarationList `;` Expression? `;` Expression? `)` Statement
57 |
58 | 1. Let _names_ be BoundNames of |VariableDeclarationList|.
59 | 1. Append to _names_ the elements of the VarDeclaredNames of |Statement|.
60 | 1. Return _names_.
61 |
62 | ForStatement : `for` `(` LexicalDeclaration Expression? `;` Expression? `)` Statement
63 |
64 | 1. Return the VarDeclaredNames of |Statement|.
65 |
66 |
67 | ForInOfStatement :
68 | `for` `(` LeftHandSideExpression `in` Expression `)` Statement
69 | `for` `(` ForDeclaration `in` Expression `)` Statement
70 | `for` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
71 | `for` `(` ForDeclaration `of` AssignmentExpression `)` Statement
72 | `for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
73 | `for` `await` `(` ForDeclaration `of` AssignmentExpression `)` Statement
74 |
75 |
76 | 1. Return the VarDeclaredNames of |Statement|.
77 |
78 |
79 | ForInOfStatement :
80 | `for` `(` `var` ForBinding `in` Expression `)` Statement
81 | `for` `(` `var` ForBinding `of` AssignmentExpression `)` Statement
82 | `for` `await` `(` `var` ForBinding `of` AssignmentExpression `)` Statement
83 |
84 |
85 | 1. Let _names_ be the BoundNames of |ForBinding|.
86 | 1. Append to _names_ the elements of the VarDeclaredNames of |Statement|.
87 | 1. Return _names_.
88 |
89 |
90 |
This section is extended by Annex .
91 |
92 | WithStatement : `with` `(` Expression `)` Statement
93 |
94 | 1. Return the VarDeclaredNames of |Statement|.
95 |
96 | SwitchStatement : `switch` `(` Expression `)` CaseBlock
97 |
98 | 1. Return the VarDeclaredNames of |CaseBlock|.
99 |
100 | CaseBlock : `{` `}`
101 |
102 | 1. Return a new empty List.
103 |
104 | CaseBlock : `{` CaseClauses? DefaultClause CaseClauses? `}`
105 |
106 | 1. If the first |CaseClauses| is present, let _names_ be the VarDeclaredNames of the first |CaseClauses|.
107 | 1. Else, let _names_ be a new empty List.
108 | 1. Append to _names_ the elements of the VarDeclaredNames of |DefaultClause|.
109 | 1. If the second |CaseClauses| is not present, return _names_.
110 | 1. Return the result of appending to _names_ the elements of the VarDeclaredNames of the second |CaseClauses|.
111 |
112 | CaseClauses : CaseClauses CaseClause
113 |
114 | 1. Let _names_ be VarDeclaredNames of |CaseClauses|.
115 | 1. Append to _names_ the elements of the VarDeclaredNames of |CaseClause|.
116 | 1. Return _names_.
117 |
118 | CaseClause : `case` Expression `:` StatementList?
119 |
120 | 1. If the |StatementList| is present, return the VarDeclaredNames of |StatementList|.
121 | 1. Return a new empty List.
122 |
123 | DefaultClause : `default` `:` StatementList?
124 |
125 | 1. If the |StatementList| is present, return the VarDeclaredNames of |StatementList|.
126 | 1. Return a new empty List.
127 |
128 | LabelledStatement : LabelIdentifier `:` LabelledItem
129 |
130 | 1. Return the VarDeclaredNames of |LabelledItem|.
131 |
132 | LabelledItem : FunctionDeclaration
133 |
134 | 1. Return a new empty List.
135 |
136 | TryStatement : `try` Block Catch
137 |
138 | 1. Let _names_ be VarDeclaredNames of |Block|.
139 | 1. Append to _names_ the elements of the VarDeclaredNames of |Catch|.
140 | 1. Return _names_.
141 |
142 | TryStatement : `try` Block Finally
143 |
144 | 1. Let _names_ be VarDeclaredNames of |Block|.
145 | 1. Append to _names_ the elements of the VarDeclaredNames of |Finally|.
146 | 1. Return _names_.
147 |
148 | TryStatement : `try` Block Catch Finally
149 |
150 | 1. Let _names_ be VarDeclaredNames of |Block|.
151 | 1. Append to _names_ the elements of the VarDeclaredNames of |Catch|.
152 | 1. Append to _names_ the elements of the VarDeclaredNames of |Finally|.
153 | 1. Return _names_.
154 |
155 | Catch : `catch` `(` CatchParameter `)` Block
156 |
157 | 1. Return the VarDeclaredNames of |Block|.
158 |
159 | FunctionStatementList : [empty]
160 |
161 | 1. Return a new empty List.
162 |
163 | FunctionStatementList : StatementList
164 |
165 | 1. Return TopLevelVarDeclaredNames of |StatementList|.
166 |
167 |
168 | ClassStaticBlockStatementList : [empty]
169 |
170 | 1. Return a new empty List.
171 |
172 | ClassStaticBlockStatementList : StatementList
173 |
174 | 1. Return the TopLevelVarDeclaredNames of |StatementList|.
175 |
176 |
177 | ConciseBody : ExpressionBody
178 |
179 | 1. Return a new empty List.
180 |
181 |
182 | AsyncConciseBody : ExpressionBody
183 |
184 |
185 | 1. Return a new empty List.
186 |
187 | ScriptBody : StatementList
188 |
189 | 1. Return TopLevelVarDeclaredNames of |StatementList|.
190 |
191 | Module : [empty]
192 |
193 | 1. Return a new empty List.
194 |
195 | ModuleItemList : ModuleItemList ModuleItem
196 |
197 | 1. Let _names_ be VarDeclaredNames of |ModuleItemList|.
198 | 1. Append to _names_ the elements of the VarDeclaredNames of |ModuleItem|.
199 | 1. Return _names_.
200 |
201 | ModuleItem : ImportDeclaration
202 |
203 | 1. Return a new empty List.
204 |
205 | ModuleItem : ExportDeclaration
206 |
207 | 1. If |ExportDeclaration| is `export` |VariableStatement|, return BoundNames of |ExportDeclaration|.
208 | 1. Return a new empty List.
209 |
210 |
211 |
--------------------------------------------------------------------------------
/spec/sec-static-semantics-varscopeddeclarations-patch.html:
--------------------------------------------------------------------------------
1 |
2 |
Static Semantics: VarScopedDeclarations
3 |
4 | Statement :
5 | EmptyStatement
6 | ExpressionStatement
7 | ContinueStatement
8 | BreakStatement
9 | ReturnStatement
10 | ThrowStatement
11 | DebuggerStatement
12 |
13 |
14 | 1. Return a new empty List.
15 |
16 | Block : `{` `}`
17 |
18 | 1. Return a new empty List.
19 |
20 | StatementList : StatementList StatementListItem
21 |
22 | 1. Let _declarations_ be VarScopedDeclarations of |StatementList|.
23 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |StatementListItem|.
24 | 1. Return _declarations_.
25 |
26 | StatementListItem : Declaration
27 |
28 | 1. Return a new empty List.
29 |
30 | VariableDeclarationList : VariableDeclaration
31 |
32 | 1. Return a List whose sole element is |VariableDeclaration|.
33 |
34 | VariableDeclarationList : VariableDeclarationList `,` VariableDeclaration
35 |
36 | 1. Let _declarations_ be VarScopedDeclarations of |VariableDeclarationList|.
37 | 1. Append |VariableDeclaration| to _declarations_.
38 | 1. Return _declarations_.
39 |
40 | IfStatement : `if` `(` Expression `)` Statement `else` Statement
41 |
42 | 1. Let _declarations_ be VarScopedDeclarations of the first |Statement|.
43 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of the second |Statement|.
44 | 1. Return _declarations_.
45 |
46 | IfStatement : `if` `(` Expression `)` Statement
47 |
48 | 1. Return the VarScopedDeclarations of |Statement|.
49 |
50 | DoWhileStatement : `do` Statement `while` `(` Expression `)` `;`
51 |
52 | 1. Return the VarScopedDeclarations of |Statement|.
53 |
54 | WhileStatement : `while` `(` Expression `)` Statement
55 |
56 | 1. Return the VarScopedDeclarations of |Statement|.
57 |
58 | ForStatement : `for` `(` Expression? `;` Expression? `;` Expression? `)` Statement
59 |
60 | 1. Return the VarScopedDeclarations of |Statement|.
61 |
62 | ForStatement : `for` `(` `var` VariableDeclarationList `;` Expression? `;` Expression? `)` Statement
63 |
64 | 1. Let _declarations_ be VarScopedDeclarations of |VariableDeclarationList|.
65 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |Statement|.
66 | 1. Return _declarations_.
67 |
68 | ForStatement : `for` `(` LexicalDeclaration Expression? `;` Expression? `)` Statement
69 |
70 | 1. Return the VarScopedDeclarations of |Statement|.
71 |
72 |
73 | ForInOfStatement :
74 | `for` `(` LeftHandSideExpression `in` Expression `)` Statement
75 | `for` `(` ForDeclaration `in` Expression `)` Statement
76 | `for` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
77 | `for` `(` ForDeclaration `of` AssignmentExpression `)` Statement
78 | `for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
79 | `for` `await` `(` ForDeclaration `of` AssignmentExpression `)` Statement
80 |
81 |
82 | 1. Return the VarScopedDeclarations of |Statement|.
83 |
84 |
85 | ForInOfStatement :
86 | `for` `(` `var` ForBinding `in` Expression `)` Statement
87 | `for` `(` `var` ForBinding `of` AssignmentExpression `)` Statement
88 | `for` `await` `(` `var` ForBinding `of` AssignmentExpression `)` Statement
89 |
90 |
91 | 1. Let _declarations_ be a List whose sole element is |ForBinding|.
92 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |Statement|.
93 | 1. Return _declarations_.
94 |
95 |
96 |
This section is extended by Annex .
97 |
98 | WithStatement : `with` `(` Expression `)` Statement
99 |
100 | 1. Return the VarScopedDeclarations of |Statement|.
101 |
102 | SwitchStatement : `switch` `(` Expression `)` CaseBlock
103 |
104 | 1. Return the VarScopedDeclarations of |CaseBlock|.
105 |
106 | CaseBlock : `{` `}`
107 |
108 | 1. Return a new empty List.
109 |
110 | CaseBlock : `{` CaseClauses? DefaultClause CaseClauses? `}`
111 |
112 | 1. If the first |CaseClauses| is present, let _declarations_ be the VarScopedDeclarations of the first |CaseClauses|.
113 | 1. Else, let _declarations_ be a new empty List.
114 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |DefaultClause|.
115 | 1. If the second |CaseClauses| is not present, return _declarations_.
116 | 1. Return the result of appending to _declarations_ the elements of the VarScopedDeclarations of the second |CaseClauses|.
117 |
118 | CaseClauses : CaseClauses CaseClause
119 |
120 | 1. Let _declarations_ be VarScopedDeclarations of |CaseClauses|.
121 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |CaseClause|.
122 | 1. Return _declarations_.
123 |
124 | CaseClause : `case` Expression `:` StatementList?
125 |
126 | 1. If the |StatementList| is present, return the VarScopedDeclarations of |StatementList|.
127 | 1. Return a new empty List.
128 |
129 | DefaultClause : `default` `:` StatementList?
130 |
131 | 1. If the |StatementList| is present, return the VarScopedDeclarations of |StatementList|.
132 | 1. Return a new empty List.
133 |
134 | LabelledStatement : LabelIdentifier `:` LabelledItem
135 |
136 | 1. Return the VarScopedDeclarations of |LabelledItem|.
137 |
138 | LabelledItem : FunctionDeclaration
139 |
140 | 1. Return a new empty List.
141 |
142 | TryStatement : `try` Block Catch
143 |
144 | 1. Let _declarations_ be VarScopedDeclarations of |Block|.
145 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |Catch|.
146 | 1. Return _declarations_.
147 |
148 | TryStatement : `try` Block Finally
149 |
150 | 1. Let _declarations_ be VarScopedDeclarations of |Block|.
151 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |Finally|.
152 | 1. Return _declarations_.
153 |
154 | TryStatement : `try` Block Catch Finally
155 |
156 | 1. Let _declarations_ be VarScopedDeclarations of |Block|.
157 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |Catch|.
158 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |Finally|.
159 | 1. Return _declarations_.
160 |
161 | Catch : `catch` `(` CatchParameter `)` Block
162 |
163 | 1. Return the VarScopedDeclarations of |Block|.
164 |
165 | FunctionStatementList : [empty]
166 |
167 | 1. Return a new empty List.
168 |
169 | FunctionStatementList : StatementList
170 |
171 | 1. Return the TopLevelVarScopedDeclarations of |StatementList|.
172 |
173 |
174 | ClassStaticBlockStatementList : [empty]
175 |
176 | 1. Return a new empty List.
177 |
178 | ClassStaticBlockStatementList : StatementList
179 |
180 | 1. Return the TopLevelVarScopedDeclarations of |StatementList|.
181 |
182 |
183 | ConciseBody : ExpressionBody
184 |
185 | 1. Return a new empty List.
186 |
187 |
188 | AsyncConciseBody : ExpressionBody
189 |
190 |
191 | 1. Return a new empty List.
192 |
193 | ScriptBody : StatementList
194 |
195 | 1. Return TopLevelVarScopedDeclarations of |StatementList|.
196 |
197 | Module : [empty]
198 |
199 | 1. Return a new empty List.
200 |
201 | ModuleItemList : ModuleItemList ModuleItem
202 |
203 | 1. Let _declarations_ be VarScopedDeclarations of |ModuleItemList|.
204 | 1. Append to _declarations_ the elements of the VarScopedDeclarations of |ModuleItem|.
205 | 1. Return _declarations_.
206 |
207 | ModuleItem : ImportDeclaration
208 |
209 | 1. Return a new empty List.
210 |
211 | ModuleItem : ExportDeclaration
212 |
213 | 1. If |ExportDeclaration| is `export` |VariableStatement|, return VarScopedDeclarations of |VariableStatement|.
214 | 1. Return a new empty List.
215 |
216 |
217 |
--------------------------------------------------------------------------------