Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

110
Visualizações
LexicallyScopedDeclarations operation doesn't make sense

let's assume we have a function and inside that function, we have a let declaration at the topmost level of the function.

now we run FunctionDeclarationInstantiation, but here comes the weird part, take a look at step 33.

Let lexDeclarations be the LexicallyScopedDeclarations of code.

so we invoked the LexicallyScopedDeclarations operation with the parse node FunctionBody.

therefore we run the implicit algorithm definition(because there is no algorithm for the FunctionBody production)

FunctionBody:FunctionStatementList
  Return LexicallyScopedDeclarations of FunctionStatementList 

so we get to this algorithm

FunctionStatementList:StatementList
  Return the TopLevelLexicallyScopedDeclarations of StatementList.

and that's where my confusion begins, because now when we invoke TopLevelLexicallyScopedDeclarations with StatementList

and we will get here

StatementList : StatementList StatementListItem
 1. Let declarations1 be TopLevelLexicallyScopedDeclarations of StatementList.
 2. Let declarations2 be TopLevelLexicallyScopedDeclarations of StatementListItem.
 3. Return the list-concatenation of declarations1 and declarations2.

finally, that will bring us to this algorithm

StatementListItem : Declaration
 1. If Declaration is Declaration : HoistableDeclaration , then
    a. Return a new empty List.
 2. Return « Declaration ».

now, how are we supposed to obtain the let variable that I've mentioned above, if step 1 says that if that Declaration is a Declaration: HoistableDeclaration then we return an empty list

it doesn't make any sense to me.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda