charly-lang / charly

🐈 The Charly Programming Language | Written by @KCreate
https://charly-lang.github.io/charly/
MIT License
199 stars 10 forks source link

Invalid self pointer in redirected methods #71

Closed KCreate closed 7 years ago

KCreate commented 7 years ago
let string = "123";
let real = "";

string.each(func(char1) {
  real = real + char1;
  string.each(func(char2) {
    real = real + char2;
  });
});

print("Expected: 112321233123");
print("Got: " + real);
Expected: 112321233123
Got: 112323
KCreate commented 7 years ago

This works as expected:

let box = {
  let nums = [1, 2, 3];
};

box.nums.each(func(e1) {
  write(e1);
  box.nums.each(func(e2) {
    write(e2);
  });
});
112321233123