Skip to content

Commit c4569e6

Browse files
authored
Fix missing autolet inner declaration block (#105)
1 parent fa0466f commit c4569e6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

source/parser.hera

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5887,6 +5887,7 @@ Init
58875887
}
58885888
}
58895889
else if (node.type == "Declaration") {
5890+
if (node.children && node.children.length) createLetDecs(node.children, scopes)
58905891
node.names.forEach((name) => currentScope.add(name))
58915892
}
58925893
else {

test/autolet.civet

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ describe "auto let", ->
3131
"""
3232

3333
describe "auto let with function", ->
34+
// TODO: We should fix the return let here, this is invalid.
3435
testCase """
3536
auto let with function
3637
---
@@ -41,13 +42,19 @@ describe "auto let with function", ->
4142
var b = 2
4243
}
4344
a = 2
45+
let c = (b) => {
46+
c = 1
47+
}
4448
---
4549
let b = 1
4650
function b(a) {
4751
a = 1
4852
var b = 2
4953
}
5054
let a = 2
55+
let c = (b) => {
56+
return let c = 1
57+
}
5158
"""
5259

5360
describe "auto let with multiple declaration", ->

0 commit comments

Comments
 (0)