Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

複合代入文の左辺が2回評価されてしまう #842

Closed
takejohn opened this issue Nov 5, 2024 · 0 comments · Fixed by #847
Closed

複合代入文の左辺が2回評価されてしまう #842

takejohn opened this issue Nov 5, 2024 · 0 comments · Fixed by #847
Assignees
Labels
bug Something isn't working

Comments

@takejohn
Copy link
Contributor

takejohn commented Nov 5, 2024

+=, -=の複合代入文において左辺の式が2回評価されてしまいます。

再現方法

var index = -1
let array = [0, 0]

@next() {
    index += 1
    return index
}

array[next()] += 1 // next()が2回実行されてしまう

// '1, 0'を期待
<: array.map(Core:to_str).join(', ') // => '0, 1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant