{"action":"closed","number":2087,"pull_request":{"url":"https://api.github.com/repos/babel/babel/pulls/2087","id":40868514,"html_url":"https://github.com/babel/babel/pull/2087","diff_url":"https://github.com/babel/babel/pull/2087.diff","patch_url":"https://github.com/babel/babel/pull/2087.patch","issue_url":"https://api.github.com/repos/babel/babel/issues/2087","number":2087,"state":"closed","locked":false,"title":"Ensure that the original state is restored on lookahead - fixes #2086","user":{"login":"loganfsmyth","id":132260,"avatar_url":"https://avatars.githubusercontent.com/u/132260?v=3","gravatar_id":"","url":"https://api.github.com/users/loganfsmyth","html_url":"https://github.com/loganfsmyth","followers_url":"https://api.github.com/users/loganfsmyth/followers","following_url":"https://api.github.com/users/loganfsmyth/following{/other_user}","gists_url":"https://api.github.com/users/loganfsmyth/gists{/gist_id}","starred_url":"https://api.github.com/users/loganfsmyth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loganfsmyth/subscriptions","organizations_url":"https://api.github.com/users/loganfsmyth/orgs","repos_url":"https://api.github.com/users/loganfsmyth/repos","events_url":"https://api.github.com/users/loganfsmyth/events{/privacy}","received_events_url":"https://api.github.com/users/loganfsmyth/received_events","type":"User","site_admin":false},"body":"This fixes this issue for things using `lookahead`, but I could see it occurring again elsewhere in the code. I'll leaving to @sebmck to think that through more.\r\n\r\nThis issue came down to\r\n\r\n    this.state.decorators.push(this.parseDecorator());\r\n\r\nlooks totally normal, but the issue is that `parseDecorator` actually triggers a lookahead in certain cases, and lookahead was removing, cloning, and reassigning `this.state`. Breaking down that line:\r\n\r\n    var decorators = this.state.decorators;\r\n    decorators.push(this.parseDecorator());\r\n\r\nwhich meant that the lookahead could swap out the decorator array with a clone of it, but then the decorator would be pushed into the old copy of the `decorators` array.\r\n\r\nThe `lookahead` case is totally fixable, but it looks like there are other cases where `this.state` is cloned like this, and it's not clear to me if they have the same chance of causing a bug like this.","created_at":"2015-07-27T03:50:33Z","updated_at":"2015-07-27T03:59:58Z","closed_at":"2015-07-27T03:59:58Z","merged_at":"2015-07-27T03:59:58Z","merge_commit_sha":"8daeee423926d62fc6fdb3e251d0e25fedfc3a51","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/babel/babel/pulls/2087/commits","review_comments_url":"https://api.github.com/repos/babel/babel/pulls/2087/comments","review_comment_url":"https://api.github.com/repos/babel/babel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/babel/babel/issues/2087/comments","statuses_url":"https://api.github.com/repos/babel/babel/statuses/0bfc5a90dc2f2eaae181dd68dfa92a84439ebb5f","head":{"label":"loganfsmyth:lookahead-state-fix","ref":"lookahead-state-fix","sha":"0bfc5a90dc2f2eaae181dd68dfa92a84439ebb5f","user":{"login":"loganfsmyth","id":132260,"avatar_url":"https://avatars.githubusercontent.com/u/132260?v=3","gravatar_id":"","url":"https://api.github.com/users/loganfsmyth","html_url":"https://github.com/loganfsmyth","followers_url":"https://api.github.com/users/loganfsmyth/followers","following_url":"https://api.github.com/users/loganfsmyth/following{/other_user}","gists_url":"https://api.github.com/users/loganfsmyth/gists{/gist_id}","starred_url":"https://api.github.com/users/loganfsmyth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loganfsmyth/subscriptions","organizations_url":"https://api.github.com/users/loganfsmyth/orgs","repos_url":"https://api.github.com/users/loganfsmyth/repos","events_url":"https://api.github.com/users/loganfsmyth/events{/privacy}","received_events_url":"https://api.github.com/users/loganfsmyth/received_events","type":"User","site_admin":false},"repo":{"id":34920245,"name":"babel","full_name":"loganfsmyth/babel","owner":{"login":"loganfsmyth","id":132260,"avatar_url":"https://avatars.githubusercontent.com/u/132260?v=3","gravatar_id":"","url":"https://api.github.com/users/loganfsmyth","html_url":"https://github.com/loganfsmyth","followers_url":"https://api.github.com/users/loganfsmyth/followers","following_url":"https://api.github.com/users/loganfsmyth/following{/other_user}","gists_url":"https://api.github.com/users/loganfsmyth/gists{/gist_id}","starred_url":"https://api.github.com/users/loganfsmyth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loganfsmyth/subscriptions","organizations_url":"https://api.github.com/users/loganfsmyth/orgs","repos_url":"https://api.github.com/users/loganfsmyth/repos","events_url":"https://api.github.com/users/loganfsmyth/events{/privacy}","received_events_url":"https://api.github.com/users/loganfsmyth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/loganfsmyth/babel","description":"Babel is a compiler for writing next generation JavaScript.","fork":true,"url":"https://api.github.com/repos/loganfsmyth/babel","forks_url":"https://api.github.com/repos/loganfsmyth/babel/forks","keys_url":"https://api.github.com/repos/loganfsmyth/babel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/loganfsmyth/babel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/loganfsmyth/babel/teams","hooks_url":"https://api.github.com/repos/loganfsmyth/babel/hooks","issue_events_url":"https://api.github.com/repos/loganfsmyth/babel/issues/events{/number}","events_url":"https://api.github.com/repos/loganfsmyth/babel/events","assignees_url":"https://api.github.com/repos/loganfsmyth/babel/assignees{/user}","branches_url":"https://api.github.com/repos/loganfsmyth/babel/branches{/branch}","tags_url":"https://api.github.com/repos/loganfsmyth/babel/tags","blobs_url":"https://api.github.com/repos/loganfsmyth/babel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/loganfsmyth/babel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/loganfsmyth/babel/git/refs{/sha}","trees_url":"https://api.github.com/repos/loganfsmyth/babel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/loganfsmyth/babel/statuses/{sha}","languages_url":"https://api.github.com/repos/loganfsmyth/babel/languages","stargazers_url":"https://api.github.com/repos/loganfsmyth/babel/stargazers","contributors_url":"https://api.github.com/repos/loganfsmyth/babel/contributors","subscribers_url":"https://api.github.com/repos/loganfsmyth/babel/subscribers","subscription_url":"https://api.github.com/repos/loganfsmyth/babel/subscription","commits_url":"https://api.github.com/repos/loganfsmyth/babel/commits{/sha}","git_commits_url":"https://api.github.com/repos/loganfsmyth/babel/git/commits{/sha}","comments_url":"https://api.github.com/repos/loganfsmyth/babel/comments{/number}","issue_comment_url":"https://api.github.com/repos/loganfsmyth/babel/issues/comments{/number}","contents_url":"https://api.github.com/repos/loganfsmyth/babel/contents/{+path}","compare_url":"https://api.github.com/repos/loganfsmyth/babel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/loganfsmyth/babel/merges","archive_url":"https://api.github.com/repos/loganfsmyth/babel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/loganfsmyth/babel/downloads","issues_url":"https://api.github.com/repos/loganfsmyth/babel/issues{/number}","pulls_url":"https://api.github.com/repos/loganfsmyth/babel/pulls{/number}","milestones_url":"https://api.github.com/repos/loganfsmyth/babel/milestones{/number}","notifications_url":"https://api.github.com/repos/loganfsmyth/babel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/loganfsmyth/babel/labels{/name}","releases_url":"https://api.github.com/repos/loganfsmyth/babel/releases{/id}","created_at":"2015-05-01T19:33:26Z","updated_at":"2015-05-01T19:33:28Z","pushed_at":"2015-07-27T03:56:15Z","git_url":"git://github.com/loganfsmyth/babel.git","ssh_url":"git@github.com:loganfsmyth/babel.git","clone_url":"https://github.com/loganfsmyth/babel.git","svn_url":"https://github.com/loganfsmyth/babel","homepage":"https://babeljs.io/","size":7543,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"babel:master","ref":"master","sha":"507303456fca28232ebc5b12f25350017ee28fd2","user":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"repo":{"id":24560307,"name":"babel","full_name":"babel/babel","owner":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/babel/babel","description":"Babel is a compiler for writing next generation JavaScript.","fork":false,"url":"https://api.github.com/repos/babel/babel","forks_url":"https://api.github.com/repos/babel/babel/forks","keys_url":"https://api.github.com/repos/babel/babel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/babel/babel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/babel/babel/teams","hooks_url":"https://api.github.com/repos/babel/babel/hooks","issue_events_url":"https://api.github.com/repos/babel/babel/issues/events{/number}","events_url":"https://api.github.com/repos/babel/babel/events","assignees_url":"https://api.github.com/repos/babel/babel/assignees{/user}","branches_url":"https://api.github.com/repos/babel/babel/branches{/branch}","tags_url":"https://api.github.com/repos/babel/babel/tags","blobs_url":"https://api.github.com/repos/babel/babel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/babel/babel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/babel/babel/git/refs{/sha}","trees_url":"https://api.github.com/repos/babel/babel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/babel/babel/statuses/{sha}","languages_url":"https://api.github.com/repos/babel/babel/languages","stargazers_url":"https://api.github.com/repos/babel/babel/stargazers","contributors_url":"https://api.github.com/repos/babel/babel/contributors","subscribers_url":"https://api.github.com/repos/babel/babel/subscribers","subscription_url":"https://api.github.com/repos/babel/babel/subscription","commits_url":"https://api.github.com/repos/babel/babel/commits{/sha}","git_commits_url":"https://api.github.com/repos/babel/babel/git/commits{/sha}","comments_url":"https://api.github.com/repos/babel/babel/comments{/number}","issue_comment_url":"https://api.github.com/repos/babel/babel/issues/comments{/number}","contents_url":"https://api.github.com/repos/babel/babel/contents/{+path}","compare_url":"https://api.github.com/repos/babel/babel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/babel/babel/merges","archive_url":"https://api.github.com/repos/babel/babel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/babel/babel/downloads","issues_url":"https://api.github.com/repos/babel/babel/issues{/number}","pulls_url":"https://api.github.com/repos/babel/babel/pulls{/number}","milestones_url":"https://api.github.com/repos/babel/babel/milestones{/number}","notifications_url":"https://api.github.com/repos/babel/babel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/babel/babel/labels{/name}","releases_url":"https://api.github.com/repos/babel/babel/releases{/id}","created_at":"2014-09-28T13:38:23Z","updated_at":"2015-07-27T02:44:47Z","pushed_at":"2015-07-27T03:59:58Z","git_url":"git://github.com/babel/babel.git","ssh_url":"git@github.com:babel/babel.git","clone_url":"https://github.com/babel/babel.git","svn_url":"https://github.com/babel/babel","homepage":"https://babeljs.io/","size":21194,"stargazers_count":8123,"watchers_count":8123,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":414,"mirror_url":null,"open_issues_count":63,"forks":414,"open_issues":63,"watchers":8123,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/babel/babel/pulls/2087"},"html":{"href":"https://github.com/babel/babel/pull/2087"},"issue":{"href":"https://api.github.com/repos/babel/babel/issues/2087"},"comments":{"href":"https://api.github.com/repos/babel/babel/issues/2087/comments"},"review_comments":{"href":"https://api.github.com/repos/babel/babel/pulls/2087/comments"},"review_comment":{"href":"https://api.github.com/repos/babel/babel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/babel/babel/pulls/2087/commits"},"statuses":{"href":"https://api.github.com/repos/babel/babel/statuses/0bfc5a90dc2f2eaae181dd68dfa92a84439ebb5f"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"sebmck","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/sebmck","html_url":"https://github.com/sebmck","followers_url":"https://api.github.com/users/sebmck/followers","following_url":"https://api.github.com/users/sebmck/following{/other_user}","gists_url":"https://api.github.com/users/sebmck/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmck/subscriptions","organizations_url":"https://api.github.com/users/sebmck/orgs","repos_url":"https://api.github.com/users/sebmck/repos","events_url":"https://api.github.com/users/sebmck/events{/privacy}","received_events_url":"https://api.github.com/users/sebmck/received_events","type":"User","site_admin":false},"comments":2,"review_comments":2,"commits":1,"additions":195,"deletions":1,"changed_files":4}}