GitHub PullRequestReviewCommentEvent at 2014-09-26 20:23:09
Repository: runtime
Actor: kevinmehall
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/tessel/runtime/pulls/comments/18111644","id":18111644,"diff_hunk":"@@ -1749,42 +1751,29 @@ if type(hs) == 'table' then\n         idx = idx + eo\n       end\n       return js_arr(ret, count)\n+    else\n+      -- Call regex.exec(str) if the global flag is not true\n+      return global.RegExp.prototype.exec(regex, this)\n     end\n-\n-    local data = tostring(this)\n-    local rc = hs.re_exec(cre, data, nil, hsmatchc, hsmatch, 0)\n-    if rc ~= 0 then\n-      return nil\n-    end\n-    local ret, pos = {}, 0\n-    for i=0,hs.regex_nsub(cre) do\n-      local so, eo = hs.regmatch_so(hsmatch, i), hs.regmatch_eo(hsmatch, i)\n-      if so == -1 or eo == -1 then\n-        table.insert(ret, pos, nil)\n-      else\n-        table.insert(ret, pos, string.sub(data, so + 1, eo))\n-      end\n-      pos = pos + 1\n-    end\n-    return js_arr(ret, pos)\n   end\n \n-  global.RegExp.prototype.exec = function (regex, subj)\n-    -- TODO wrong\n-    local cre = getmetatable(regex).cre\n-    local crestr = getmetatable(regex).crestr\n-    if type(cre) ~= 'userdata' then\n-      error(js_new(global.TypeError, 'Cannot call RegExp.prototype.match on non-regex'))\n-    end\n-\n+  global.RegExp.prototype.exec = function (this, subj)\n+    local cre = getmetatable(this).cre\n+    local crestr = getmetatable(this).crestr\n     local data = tostring(subj)\n     local rc = hs.re_exec(cre, data, nil, hsmatchc, hsmatch, 0)\n+    local ret, len = {}, 0\n+    local so = 0\n+    local eo = 0\n+    local index = 0","path":"src/colony/lua/colony-js.lua","position":null,"original_position":96,"commit_id":"04303a9957d65de1756c253df738173fa06cc9e3","original_commit_id":"58b04754a8c22d51235f18fe19e57cf505f51ea7","user":{"login":"kevinmehall","id":119951,"avatar_url":"https://avatars.githubusercontent.com/u/119951?v=2","gravatar_id":"","url":"https://api.github.com/users/kevinmehall","html_url":"https://github.com/kevinmehall","followers_url":"https://api.github.com/users/kevinmehall/followers","following_url":"https://api.github.com/users/kevinmehall/following{/other_user}","gists_url":"https://api.github.com/users/kevinmehall/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinmehall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinmehall/subscriptions","organizations_url":"https://api.github.com/users/kevinmehall/orgs","repos_url":"https://api.github.com/users/kevinmehall/repos","events_url":"https://api.github.com/users/kevinmehall/events{/privacy}","received_events_url":"https://api.github.com/users/kevinmehall/received_events","type":"User","site_admin":false},"body":"And the `index` variable isn't used now, so can be removed.","created_at":"2014-09-26T20:23:09Z","updated_at":"2014-09-26T20:23:09Z","html_url":"https://github.com/tessel/runtime/pull/485#discussion_r18111644","pull_request_url":"https://api.github.com/repos/tessel/runtime/pulls/485","_links":{"self":{"href":"https://api.github.com/repos/tessel/runtime/pulls/comments/18111644"},"html":{"href":"https://github.com/tessel/runtime/pull/485#discussion_r18111644"},"pull_request":{"href":"https://api.github.com/repos/tessel/runtime/pulls/485"}}},"pull_request":{"url":"https://api.github.com/repos/tessel/runtime/pulls/485","id":21753249,"html_url":"https://github.com/tessel/runtime/pull/485","diff_url":"https://github.com/tessel/runtime/pull/485.diff","patch_url":"https://github.com/tessel/runtime/pull/485.patch","issue_url":"https://api.github.com/repos/tessel/runtime/issues/485","number":485,"state":"open","locked":false,"title":"fix String.match() with non-regex parameter","user":{"login":"micnic","id":1449826,"avatar_url":"https://avatars.githubusercontent.com/u/1449826?v=2","gravatar_id":"","url":"https://api.github.com/users/micnic","html_url":"https://github.com/micnic","followers_url":"https://api.github.com/users/micnic/followers","following_url":"https://api.github.com/users/micnic/following{/other_user}","gists_url":"https://api.github.com/users/micnic/gists{/gist_id}","starred_url":"https://api.github.com/users/micnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micnic/subscriptions","organizations_url":"https://api.github.com/users/micnic/orgs","repos_url":"https://api.github.com/users/micnic/repos","events_url":"https://api.github.com/users/micnic/events{/privacy}","received_events_url":"https://api.github.com/users/micnic/received_events","type":"User","site_admin":false},"body":"related to issue #482\r\n\r\nThere are still some JS incompatibilities that should be fixed:\r\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match\r\n> The returned Array has an extra input property, which contains the original string that was parsed. In addition, it has an index property, which represents the zero-based index of the match in the string.\r\n\r\nI could not figure out where to get the `index` value so added only the fix to not throw the TypeError.","created_at":"2014-09-24T23:47:19Z","updated_at":"2014-09-26T20:23:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"98ebebffee2991d4cbaa470d787c345dd5bd1ecf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tessel/runtime/pulls/485/commits","review_comments_url":"https://api.github.com/repos/tessel/runtime/pulls/485/comments","review_comment_url":"https://api.github.com/repos/tessel/runtime/pulls/comments/{number}","comments_url":"https://api.github.com/repos/tessel/runtime/issues/485/comments","statuses_url":"https://api.github.com/repos/tessel/runtime/statuses/04303a9957d65de1756c253df738173fa06cc9e3","head":{"label":"micnic:master","ref":"master","sha":"04303a9957d65de1756c253df738173fa06cc9e3","user":{"login":"micnic","id":1449826,"avatar_url":"https://avatars.githubusercontent.com/u/1449826?v=2","gravatar_id":"","url":"https://api.github.com/users/micnic","html_url":"https://github.com/micnic","followers_url":"https://api.github.com/users/micnic/followers","following_url":"https://api.github.com/users/micnic/following{/other_user}","gists_url":"https://api.github.com/users/micnic/gists{/gist_id}","starred_url":"https://api.github.com/users/micnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micnic/subscriptions","organizations_url":"https://api.github.com/users/micnic/orgs","repos_url":"https://api.github.com/users/micnic/repos","events_url":"https://api.github.com/users/micnic/events{/privacy}","received_events_url":"https://api.github.com/users/micnic/received_events","type":"User","site_admin":false},"repo":{"id":24436035,"name":"runtime","full_name":"micnic/runtime","owner":{"login":"micnic","id":1449826,"avatar_url":"https://avatars.githubusercontent.com/u/1449826?v=2","gravatar_id":"","url":"https://api.github.com/users/micnic","html_url":"https://github.com/micnic","followers_url":"https://api.github.com/users/micnic/followers","following_url":"https://api.github.com/users/micnic/following{/other_user}","gists_url":"https://api.github.com/users/micnic/gists{/gist_id}","starred_url":"https://api.github.com/users/micnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micnic/subscriptions","organizations_url":"https://api.github.com/users/micnic/orgs","repos_url":"https://api.github.com/users/micnic/repos","events_url":"https://api.github.com/users/micnic/events{/privacy}","received_events_url":"https://api.github.com/users/micnic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/micnic/runtime","description":"Tessel JS runtime","fork":true,"url":"https://api.github.com/repos/micnic/runtime","forks_url":"https://api.github.com/repos/micnic/runtime/forks","keys_url":"https://api.github.com/repos/micnic/runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/micnic/runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/micnic/runtime/teams","hooks_url":"https://api.github.com/repos/micnic/runtime/hooks","issue_events_url":"https://api.github.com/repos/micnic/runtime/issues/events{/number}","events_url":"https://api.github.com/repos/micnic/runtime/events","assignees_url":"https://api.github.com/repos/micnic/runtime/assignees{/user}","branches_url":"https://api.github.com/repos/micnic/runtime/branches{/branch}","tags_url":"https://api.github.com/repos/micnic/runtime/tags","blobs_url":"https://api.github.com/repos/micnic/runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/micnic/runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/micnic/runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/micnic/runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/micnic/runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/micnic/runtime/languages","stargazers_url":"https://api.github.com/repos/micnic/runtime/stargazers","contributors_url":"https://api.github.com/repos/micnic/runtime/contributors","subscribers_url":"https://api.github.com/repos/micnic/runtime/subscribers","subscription_url":"https://api.github.com/repos/micnic/runtime/subscription","commits_url":"https://api.github.com/repos/micnic/runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/micnic/runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/micnic/runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/micnic/runtime/issues/comments/{number}","contents_url":"https://api.github.com/repos/micnic/runtime/contents/{+path}","compare_url":"https://api.github.com/repos/micnic/runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/micnic/runtime/merges","archive_url":"https://api.github.com/repos/micnic/runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/micnic/runtime/downloads","issues_url":"https://api.github.com/repos/micnic/runtime/issues{/number}","pulls_url":"https://api.github.com/repos/micnic/runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/micnic/runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/micnic/runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/micnic/runtime/labels{/name}","releases_url":"https://api.github.com/repos/micnic/runtime/releases{/id}","created_at":"2014-09-24T23:17:31Z","updated_at":"2014-09-24T23:32:55Z","pushed_at":"2014-09-26T20:20:10Z","git_url":"git://github.com/micnic/runtime.git","ssh_url":"git@github.com:micnic/runtime.git","clone_url":"https://github.com/micnic/runtime.git","svn_url":"https://github.com/micnic/runtime","homepage":"","size":17703,"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":"tessel:master","ref":"master","sha":"adf0c51f2056e3cee2cdb1713358888490facd0f","user":{"login":"tessel","id":5573563,"avatar_url":"https://avatars.githubusercontent.com/u/5573563?v=2","gravatar_id":"","url":"https://api.github.com/users/tessel","html_url":"https://github.com/tessel","followers_url":"https://api.github.com/users/tessel/followers","following_url":"https://api.github.com/users/tessel/following{/other_user}","gists_url":"https://api.github.com/users/tessel/gists{/gist_id}","starred_url":"https://api.github.com/users/tessel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tessel/subscriptions","organizations_url":"https://api.github.com/users/tessel/orgs","repos_url":"https://api.github.com/users/tessel/repos","events_url":"https://api.github.com/users/tessel/events{/privacy}","received_events_url":"https://api.github.com/users/tessel/received_events","type":"Organization","site_admin":false},"repo":{"id":14543043,"name":"runtime","full_name":"tessel/runtime","owner":{"login":"tessel","id":5573563,"avatar_url":"https://avatars.githubusercontent.com/u/5573563?v=2","gravatar_id":"","url":"https://api.github.com/users/tessel","html_url":"https://github.com/tessel","followers_url":"https://api.github.com/users/tessel/followers","following_url":"https://api.github.com/users/tessel/following{/other_user}","gists_url":"https://api.github.com/users/tessel/gists{/gist_id}","starred_url":"https://api.github.com/users/tessel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tessel/subscriptions","organizations_url":"https://api.github.com/users/tessel/orgs","repos_url":"https://api.github.com/users/tessel/repos","events_url":"https://api.github.com/users/tessel/events{/privacy}","received_events_url":"https://api.github.com/users/tessel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tessel/runtime","description":"Tessel JS runtime","fork":false,"url":"https://api.github.com/repos/tessel/runtime","forks_url":"https://api.github.com/repos/tessel/runtime/forks","keys_url":"https://api.github.com/repos/tessel/runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tessel/runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tessel/runtime/teams","hooks_url":"https://api.github.com/repos/tessel/runtime/hooks","issue_events_url":"https://api.github.com/repos/tessel/runtime/issues/events{/number}","events_url":"https://api.github.com/repos/tessel/runtime/events","assignees_url":"https://api.github.com/repos/tessel/runtime/assignees{/user}","branches_url":"https://api.github.com/repos/tessel/runtime/branches{/branch}","tags_url":"https://api.github.com/repos/tessel/runtime/tags","blobs_url":"https://api.github.com/repos/tessel/runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tessel/runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tessel/runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/tessel/runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tessel/runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/tessel/runtime/languages","stargazers_url":"https://api.github.com/repos/tessel/runtime/stargazers","contributors_url":"https://api.github.com/repos/tessel/runtime/contributors","subscribers_url":"https://api.github.com/repos/tessel/runtime/subscribers","subscription_url":"https://api.github.com/repos/tessel/runtime/subscription","commits_url":"https://api.github.com/repos/tessel/runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/tessel/runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/tessel/runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/tessel/runtime/issues/comments/{number}","contents_url":"https://api.github.com/repos/tessel/runtime/contents/{+path}","compare_url":"https://api.github.com/repos/tessel/runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tessel/runtime/merges","archive_url":"https://api.github.com/repos/tessel/runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tessel/runtime/downloads","issues_url":"https://api.github.com/repos/tessel/runtime/issues{/number}","pulls_url":"https://api.github.com/repos/tessel/runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/tessel/runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/tessel/runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tessel/runtime/labels{/name}","releases_url":"https://api.github.com/repos/tessel/runtime/releases{/id}","created_at":"2013-11-20T01:16:24Z","updated_at":"2014-09-24T19:53:19Z","pushed_at":"2014-09-26T19:57:29Z","git_url":"git://github.com/tessel/runtime.git","ssh_url":"git@github.com:tessel/runtime.git","clone_url":"https://github.com/tessel/runtime.git","svn_url":"https://github.com/tessel/runtime","homepage":"","size":32986,"stargazers_count":45,"watchers_count":45,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":127,"forks":20,"open_issues":127,"watchers":45,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tessel/runtime/pulls/485"},"html":{"href":"https://github.com/tessel/runtime/pull/485"},"issue":{"href":"https://api.github.com/repos/tessel/runtime/issues/485"},"comments":{"href":"https://api.github.com/repos/tessel/runtime/issues/485/comments"},"review_comments":{"href":"https://api.github.com/repos/tessel/runtime/pulls/485/comments"},"review_comment":{"href":"https://api.github.com/repos/tessel/runtime/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/tessel/runtime/pulls/485/commits"},"statuses":{"href":"https://api.github.com/repos/tessel/runtime/statuses/04303a9957d65de1756c253df738173fa06cc9e3"}}}}