8.5 Contains
8.5.1 Static Semantics: Contains
The
Every grammar production alternative in this specification which is not listed below implicitly has the following default definition of Contains:
- For each child node child of this
Parse Node , do- If child is an instance of symbol, return
true . - If child is an instance of a nonterminal, then
- Let contained be the result of child
Contains symbol. - If contained is
true , returntrue .
- Let contained be the result of child
- If child is an instance of symbol, return
- Return
false .
- Return
false .
Static semantic rules that depend upon substructure generally do not look into function definitions.
- If symbol is
ClassBody , returntrue . - If symbol is
ClassHeritage , then- If
ClassHeritage is present, returntrue ; otherwise returnfalse .
- If
- If
ClassHeritage is present, then- If
ClassHeritage Contains symbol istrue , returntrue .
- If
- Return the result of
ComputedPropertyContains ofClassBody with argument symbol.
Static semantic rules that depend upon substructure generally do not look into class bodies except for
- Return
false .
Static semantic rules that depend upon substructure generally do not look into static
initialization blocks.
- If symbol is not one of
NewTarget ,SuperProperty ,SuperCall ,super
, orthis
, returnfalse . - If
ArrowParameters Contains symbol istrue , returntrue . - Return
ConciseBody Contains symbol.
- Let formals be the
ArrowFormalParameters that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - Return formals
Contains symbol.
- If symbol is not one of
NewTarget ,SuperProperty ,SuperCall ,super
, orthis
, returnfalse . - Return
AsyncConciseBody Contains symbol.
- If symbol is not one of
NewTarget ,SuperProperty ,SuperCall ,super
, orthis
, returnfalse . - Let head be the
AsyncArrowHead that iscovered byCoverCallExpressionAndAsyncArrowHead . - If head
Contains symbol istrue , returntrue . - Return
AsyncConciseBody Contains symbol.
Contains is used to detect new.target
, this
, and super
usage within an
- If symbol is
MethodDefinition , returntrue . - Return the result of
ComputedPropertyContains ofMethodDefinition with argument symbol.
- Return
false .
- If
MemberExpression Contains symbol istrue , returntrue . - Return
false .
- If symbol is the
ReservedWord super
, returntrue . - Return
false .
- If
CallExpression Contains symbol istrue , returntrue . - Return
false .
- Return
false .
- If
OptionalChain Contains symbol istrue , returntrue . - Return
false .
8.5.2 Static Semantics: ComputedPropertyContains
The
- Return
false .
- Return the result of
ComputedPropertyName Contains symbol.
- Return the result of
ComputedPropertyContains ofClassElementName with argument symbol.
- Return the result of
ComputedPropertyContains ofClassElementName with argument symbol.
- Return the result of
ComputedPropertyContains ofClassElementName with argument symbol.
- Let inList be
ComputedPropertyContains ofClassElementList with argument symbol. - If inList is
true , returntrue . - Return the result of
ComputedPropertyContains ofClassElement with argument symbol.
- Return
false .
- Return
false .
- Return the result of
ComputedPropertyContains ofClassElementName with argument symbol.
- Return the result of
ComputedPropertyContains ofClassElementName with argument symbol.