diff options
Diffstat (limited to 'lib/ast.js')
-rw-r--r-- | lib/ast.js | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -754,6 +754,17 @@ var AST_Const = DEFNODE("Const", null, { }, }, AST_Definitions); +var AST_Let = DEFNODE("Let", null, { + $documentation: "A `let` statement", + _validate: function() { + this.definitions.forEach(function(node) { + if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]"); + if (!(node.name instanceof AST_SymbolLet)) throw new Error("name must be AST_SymbolLet"); + if (node.value != null) must_be_expression(node, "value"); + }); + }, +}, AST_Definitions); + var AST_Var = DEFNODE("Var", null, { $documentation: "A `var` statement", _validate: function() { @@ -1066,6 +1077,10 @@ var AST_SymbolConst = DEFNODE("SymbolConst", null, { $documentation: "Symbol defining a constant", }, AST_SymbolDeclaration); +var AST_SymbolLet = DEFNODE("SymbolLet", null, { + $documentation: "Symbol defining a lexical-scoped variable", +}, AST_SymbolDeclaration); + var AST_SymbolVar = DEFNODE("SymbolVar", null, { $documentation: "Symbol defining a variable", }, AST_SymbolDeclaration); |