aboutsummaryrefslogtreecommitdiff
path: root/lib/ast.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ast.js')
-rw-r--r--lib/ast.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 5ce591cc..a87e9c58 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -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);