diff --git a/source/parser.hera b/source/parser.hera index d098ea4bb..3f0d7b427 100644 --- a/source/parser.hera +++ b/source/parser.hera @@ -5851,6 +5851,7 @@ Init } } else if (node.type == "Declaration") { + if (node.children && node.children.length) createLetDecs(node.children, scopes) node.names.forEach((name) => currentScope.add(name)) } else { diff --git a/test/autolet.civet b/test/autolet.civet index 4cc3b37dd..b48d2d912 100644 --- a/test/autolet.civet +++ b/test/autolet.civet @@ -31,6 +31,7 @@ describe "auto let", -> """ describe "auto let with function", -> + // TODO: We should fix the return let here, this is invalid. testCase """ auto let with function --- @@ -41,6 +42,9 @@ describe "auto let with function", -> var b = 2 } a = 2 + let c = (b) => { + c = 1 + } --- let b = 1 function b(a) { @@ -48,6 +52,9 @@ describe "auto let with function", -> var b = 2 } let a = 2 + let c = (b) => { + return let c = 1 + } """ describe "auto let with multiple declaration", ->