Skip to content

ECMA 6 - Implement Let and Const Declarations #141

@pemattio

Description

@pemattio

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions