Add local variables (#8740)

Fixes: #2752

ChangeLog: Added local variable with `let`
This commit is contained in:
Avery Townsend 2025-06-26 09:36:49 -04:00 committed by GitHub
parent 3640cb8b97
commit d2a5ae03dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 554 additions and 23 deletions

View file

@ -367,7 +367,8 @@ declare_syntax! {
/// the right-hand-side of a binding
// Fixme: the test should be a or
BindingExpression-> [ ?CodeBlock, ?Expression ],
CodeBlock-> [ *Expression, *ReturnStatement ],
CodeBlock-> [ *Expression, *LetStatement, *ReturnStatement ],
LetStatement -> [ DeclaredIdentifier, ?Type, Expression ],
ReturnStatement -> [ ?Expression ],
// FIXME: the test should test that as alternative rather than several of them (but it can also be a literal)
Expression-> [ ?Expression, ?FunctionCallExpression, ?IndexExpression, ?SelfAssignment,