{"action":"created","issue":{"url":"https://api.github.com/repos/krkrz/krkrz/issues/226","repository_url":"https://api.github.com/repos/krkrz/krkrz","labels_url":"https://api.github.com/repos/krkrz/krkrz/issues/226/labels{/name}","comments_url":"https://api.github.com/repos/krkrz/krkrz/issues/226/comments","events_url":"https://api.github.com/repos/krkrz/krkrz/issues/226/events","html_url":"https://github.com/krkrz/krkrz/issues/226","id":150737402,"number":226,"title":"for 文の挙動について","user":{"login":"pute293","id":6694525,"avatar_url":"https://avatars.githubusercontent.com/u/6694525?v=3","gravatar_id":"","url":"https://api.github.com/users/pute293","html_url":"https://github.com/pute293","followers_url":"https://api.github.com/users/pute293/followers","following_url":"https://api.github.com/users/pute293/following{/other_user}","gists_url":"https://api.github.com/users/pute293/gists{/gist_id}","starred_url":"https://api.github.com/users/pute293/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pute293/subscriptions","organizations_url":"https://api.github.com/users/pute293/orgs","repos_url":"https://api.github.com/users/pute293/repos","events_url":"https://api.github.com/users/pute293/events{/privacy}","received_events_url":"https://api.github.com/users/pute293/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/krkrz/krkrz/labels/%E7%8F%BE%E7%8A%B6%E9%80%B2%E8%A1%8C","name":"現状進行","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-25T03:29:43Z","updated_at":"2016-04-26T02:33:00Z","closed_at":null,"body":"for 文の初期化式を書く・書かないで for 文のスコープが変わりますが、これは想定された動作でしょうか？\r\n- 挙動\r\n```\r\nvar x = void, y = void;\r\nfor (var a = 0; a < 10; ++a) var x = a;\r\n// for (...) { statement } として解釈され、\r\n// x は void のまま\r\nvar b = 0;\r\nfor (; b < 10; ++b) var y = b;\r\n// for (...) statement として解釈され、\r\n// y は 9 になる\r\n```\r\n\r\n- 原因\r\nsrc/core/tjs2/syntax/tjs.y の for_first_clause 内で呼ばれている tTJSInterCodeContext::EnterForCode が、初期化式が変数宣言でないときブロックを作らないため\r\n\r\n- 提案\r\ntTJSInterCodeContext::EnterForCode が常にブロックを生成するように変更し、上記挙動で y が void になるようにする\r\n\r\n- 既存コードへの影響\r\n破壊的変更であり、上記挙動に依存したコードが動かなくなる"},"comment":{"url":"https://api.github.com/repos/krkrz/krkrz/issues/comments/214589016","html_url":"https://github.com/krkrz/krkrz/issues/226#issuecomment-214589016","issue_url":"https://api.github.com/repos/krkrz/krkrz/issues/226","id":214589016,"user":{"login":"pute293","id":6694525,"avatar_url":"https://avatars.githubusercontent.com/u/6694525?v=3","gravatar_id":"","url":"https://api.github.com/users/pute293","html_url":"https://github.com/pute293","followers_url":"https://api.github.com/users/pute293/followers","following_url":"https://api.github.com/users/pute293/following{/other_user}","gists_url":"https://api.github.com/users/pute293/gists{/gist_id}","starred_url":"https://api.github.com/users/pute293/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pute293/subscriptions","organizations_url":"https://api.github.com/users/pute293/orgs","repos_url":"https://api.github.com/users/pute293/repos","events_url":"https://api.github.com/users/pute293/events{/privacy}","received_events_url":"https://api.github.com/users/pute293/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T02:33:00Z","updated_at":"2016-04-26T02:33:00Z","body":"ぎゃ、すみません、自分のレポジトリに push した履歴がこっちに残っちゃいました。\r\nb1d7d76 （最後のやつ）以外は無視してください。"}}