Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!