puma
puma copied to clipboard
ECMA 6 - Implement Let and Const Declarations
The runtime need to has the visitor for the let and const statements. For this implementation please check this link related to current supported specification.
Examples of errors
const pi=3.14
const pi=3.14
SyntaxError: redeclaration of const pi
const pi=3.14
pi=3.14
TypeError: invalid assignment to const `pi'
if(true) {let a = 2} a;
ReferenceError: a is not defined
let a=1; if(true) {console.log(a); let a=2}
ReferenceError: can't access lexical declaration `a' before initialization