Closed KCreate closed 8 years ago
This is most likely a bug caused by TFunc having the same bound_stack for each call and primitive member redirection injecting something weird as the self
keyword.
Another example:
let Box = {
let children = ["test", "what"];
let iterate = children.each;
func length() {
5;
};
func __member(index) {
print("__member: " + index);
};
};
Box.children.push(1);
Box.children.push(2);
Box.children.push(3);
Box.iterate(func(e) {
print(e);
});
Output:
❯ charly test/debug.charly
__member: 0
null
__member: 1
null
__member: 2
null
__member: 3
null
__member: 4
null
This is most likely where this bug is caused: https://github.com/KCreate/charly-lang/blob/master/src/charly/interpreter/interpreter.cr#L749-L767
Duplicate of #71
Reduced:
Output: