{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/comments/129148528","pull_request_review_id":51892364,"id":129148528,"diff_hunk":"@@ -0,0 +1,129 @@\n+// Copyright 2017 The Chromium Authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style license that can be\n+// found in the LICENSE file.\n+'use strict';\n+\n+foam.CLASS({\n+  package: 'org.chromium.webidl',\n+  name: 'Canonicalizer',\n+\n+  documentation: `This component expects to receive AST nodes from various\n+    sources. Canonical versions of interface definitions will be created\n+    from AST nodes of the same source.\n+    Please note that this step cannot be distributed. All computations\n+    must be done through one canonicalizer instances, or you will\n+    get fragmented results.`,\n+\n+  requires: [\n+    'org.chromium.webidl.ast.Enum',\n+    'org.chromium.webidl.ast.Typedef',\n+    'org.chromium.webidl.PipelineMessage',\n+  ],\n+\n+  properties: [\n+    {\n+      class: 'Function',\n+      documentation: `Function is called after waitTime seconds has passed\n+        since the last call to addFragment.`,\n+      name: 'onDone',\n+      required: true,\n+    },\n+    {\n+      class: 'Int',\n+      documentation: `The amount of time to wait in seconds after the last\n+        addFragment request, before onDone() is called with the canonical\n+        IDL files.`,\n+      name: 'waitTime',\n+    },\n+    {\n+      documentation: `A map of maps containing canonical IDL files. The\n+        key of the map corresponds to the renderer (source) from which the\n+        files were extract. For example, rendererMap['blink'] is a map that\n+        contains the canonical IDL files from the Blink repo.`,\n+      name: 'rendererMap_',\n+      factory: function() { return {}; },\n+    },\n+    {\n+      documentation: `A map of Timers that is used to determine whether waitTime\n+        has passed since the last call to addFragment.`,\n+      name: 'timerMap_',\n+      factory: function() { return {}; },\n+    },\n+  ],\n+\n+  methods: [\n+    {\n+      documentation: `Takes a given AST and extracts the definition members\n+        from the AST. The members are then placed into the map corresponding to\n+        the given source and interface.`,\n+      name: 'addFragment',\n+      code: function(source, ast, metadata) {\n+        // Determine if Map exists for this source. Create one if non-existent.\n+        var map = this.rendererMap_[source];\n+        if (!map) {\n+          map = {};\n+          this.rendererMap_[source] = map;\n+        }\n+\n+        var def = ast.definition;\n+        // Ignore definition if Enum or Typedef.\n+        if (this.Enum.isInstance(def) || this.Typedef.isInstance(def)) return;\n+\n+        // Find any existing interface with same id (name).\n+        var clone = ast.clone();\n+        var result = map[ast.id];\n+\n+        if (!result) {\n+          // No interface with the same name was found.\n+          // We add a copy of ourselves into the map.\n+          clone.ref = [metadata];\n+          map[ast.id] = clone;\n+        } else {\n+          // An interface with the same name was found.\n+          var isCanonicalPartial = result.definition.isPartial;\n+          var isDefPartial = def.isPartial;\n+\n+          // Determine if we have multiple non-partial fragments.\n+          if (!isCanonicalPartial && !isDefPartial) {\n+            console.error(`Two non-partial fragments!\n+              In Map: ${result.ref},\n+              Current: ${metadata}`);\n+            throw new Error('Two non-partial fragments were found for the same interface!');\n+          }\n+\n+          // Copy attributes and members from definition into canonical AST.\n+          result.attrs = result.attrs.concat(clone.attrs);\n+          result.definition.members = result.definition.members\n+            .concat(clone.definition.members);\n+          result.ref.push(metadata);\n+\n+          // Copy over inheritance information.\n+          if (!result.definition.inheritsFrom)","path":"lib/org/chromium/webidl/Canonicalizer.js","position":108,"original_position":101,"commit_id":"99276f46b9a42c7908fadd24f56f611bd3aeb449","original_commit_id":"14c177c3f3e8bea258d691c3dfc3e7eea9d38c1d","user":{"login":"m-cheung","id":9053820,"avatar_url":"https://avatars2.githubusercontent.com/u/9053820?v=4","gravatar_id":"","url":"https://api.github.com/users/m-cheung","html_url":"https://github.com/m-cheung","followers_url":"https://api.github.com/users/m-cheung/followers","following_url":"https://api.github.com/users/m-cheung/following{/other_user}","gists_url":"https://api.github.com/users/m-cheung/gists{/gist_id}","starred_url":"https://api.github.com/users/m-cheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-cheung/subscriptions","organizations_url":"https://api.github.com/users/m-cheung/orgs","repos_url":"https://api.github.com/users/m-cheung/repos","events_url":"https://api.github.com/users/m-cheung/events{/privacy}","received_events_url":"https://api.github.com/users/m-cheung/received_events","type":"User","site_admin":false},"body":"This assumes that we will process multiple non-partials correct? As I mentioned in another comment, I don't think multiple non-partial fragments are defined (assuming we have a correct set of data).","created_at":"2017-07-24T20:44:17Z","updated_at":"2017-07-24T20:44:17Z","html_url":"https://github.com/GoogleChrome/webidl-diff/pull/67#discussion_r129148528","pull_request_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/comments/129148528"},"html":{"href":"https://github.com/GoogleChrome/webidl-diff/pull/67#discussion_r129148528"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/67","id":131842105,"html_url":"https://github.com/GoogleChrome/webidl-diff/pull/67","diff_url":"https://github.com/GoogleChrome/webidl-diff/pull/67.diff","patch_url":"https://github.com/GoogleChrome/webidl-diff/pull/67.patch","issue_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/issues/67","number":67,"state":"open","locked":false,"title":"Adding Canonicalizer component of pipeline","user":{"login":"m-cheung","id":9053820,"avatar_url":"https://avatars2.githubusercontent.com/u/9053820?v=4","gravatar_id":"","url":"https://api.github.com/users/m-cheung","html_url":"https://github.com/m-cheung","followers_url":"https://api.github.com/users/m-cheung/followers","following_url":"https://api.github.com/users/m-cheung/following{/other_user}","gists_url":"https://api.github.com/users/m-cheung/gists{/gist_id}","starred_url":"https://api.github.com/users/m-cheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-cheung/subscriptions","organizations_url":"https://api.github.com/users/m-cheung/orgs","repos_url":"https://api.github.com/users/m-cheung/repos","events_url":"https://api.github.com/users/m-cheung/events{/privacy}","received_events_url":"https://api.github.com/users/m-cheung/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-21T19:24:48Z","updated_at":"2017-07-24T20:44:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba5c38a24e130a96c032659190f71b9f7fd8f127","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/67/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/67/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/issues/67/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/statuses/99276f46b9a42c7908fadd24f56f611bd3aeb449","head":{"label":"m-cheung:CanonicalizerRunner","ref":"CanonicalizerRunner","sha":"99276f46b9a42c7908fadd24f56f611bd3aeb449","user":{"login":"m-cheung","id":9053820,"avatar_url":"https://avatars2.githubusercontent.com/u/9053820?v=4","gravatar_id":"","url":"https://api.github.com/users/m-cheung","html_url":"https://github.com/m-cheung","followers_url":"https://api.github.com/users/m-cheung/followers","following_url":"https://api.github.com/users/m-cheung/following{/other_user}","gists_url":"https://api.github.com/users/m-cheung/gists{/gist_id}","starred_url":"https://api.github.com/users/m-cheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-cheung/subscriptions","organizations_url":"https://api.github.com/users/m-cheung/orgs","repos_url":"https://api.github.com/users/m-cheung/repos","events_url":"https://api.github.com/users/m-cheung/events{/privacy}","received_events_url":"https://api.github.com/users/m-cheung/received_events","type":"User","site_admin":false},"repo":{"id":90782549,"name":"webidl-diff","full_name":"m-cheung/webidl-diff","owner":{"login":"m-cheung","id":9053820,"avatar_url":"https://avatars2.githubusercontent.com/u/9053820?v=4","gravatar_id":"","url":"https://api.github.com/users/m-cheung","html_url":"https://github.com/m-cheung","followers_url":"https://api.github.com/users/m-cheung/followers","following_url":"https://api.github.com/users/m-cheung/following{/other_user}","gists_url":"https://api.github.com/users/m-cheung/gists{/gist_id}","starred_url":"https://api.github.com/users/m-cheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-cheung/subscriptions","organizations_url":"https://api.github.com/users/m-cheung/orgs","repos_url":"https://api.github.com/users/m-cheung/repos","events_url":"https://api.github.com/users/m-cheung/events{/privacy}","received_events_url":"https://api.github.com/users/m-cheung/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/m-cheung/webidl-diff","description":null,"fork":true,"url":"https://api.github.com/repos/m-cheung/webidl-diff","forks_url":"https://api.github.com/repos/m-cheung/webidl-diff/forks","keys_url":"https://api.github.com/repos/m-cheung/webidl-diff/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m-cheung/webidl-diff/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m-cheung/webidl-diff/teams","hooks_url":"https://api.github.com/repos/m-cheung/webidl-diff/hooks","issue_events_url":"https://api.github.com/repos/m-cheung/webidl-diff/issues/events{/number}","events_url":"https://api.github.com/repos/m-cheung/webidl-diff/events","assignees_url":"https://api.github.com/repos/m-cheung/webidl-diff/assignees{/user}","branches_url":"https://api.github.com/repos/m-cheung/webidl-diff/branches{/branch}","tags_url":"https://api.github.com/repos/m-cheung/webidl-diff/tags","blobs_url":"https://api.github.com/repos/m-cheung/webidl-diff/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m-cheung/webidl-diff/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m-cheung/webidl-diff/git/refs{/sha}","trees_url":"https://api.github.com/repos/m-cheung/webidl-diff/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m-cheung/webidl-diff/statuses/{sha}","languages_url":"https://api.github.com/repos/m-cheung/webidl-diff/languages","stargazers_url":"https://api.github.com/repos/m-cheung/webidl-diff/stargazers","contributors_url":"https://api.github.com/repos/m-cheung/webidl-diff/contributors","subscribers_url":"https://api.github.com/repos/m-cheung/webidl-diff/subscribers","subscription_url":"https://api.github.com/repos/m-cheung/webidl-diff/subscription","commits_url":"https://api.github.com/repos/m-cheung/webidl-diff/commits{/sha}","git_commits_url":"https://api.github.com/repos/m-cheung/webidl-diff/git/commits{/sha}","comments_url":"https://api.github.com/repos/m-cheung/webidl-diff/comments{/number}","issue_comment_url":"https://api.github.com/repos/m-cheung/webidl-diff/issues/comments{/number}","contents_url":"https://api.github.com/repos/m-cheung/webidl-diff/contents/{+path}","compare_url":"https://api.github.com/repos/m-cheung/webidl-diff/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m-cheung/webidl-diff/merges","archive_url":"https://api.github.com/repos/m-cheung/webidl-diff/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m-cheung/webidl-diff/downloads","issues_url":"https://api.github.com/repos/m-cheung/webidl-diff/issues{/number}","pulls_url":"https://api.github.com/repos/m-cheung/webidl-diff/pulls{/number}","milestones_url":"https://api.github.com/repos/m-cheung/webidl-diff/milestones{/number}","notifications_url":"https://api.github.com/repos/m-cheung/webidl-diff/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m-cheung/webidl-diff/labels{/name}","releases_url":"https://api.github.com/repos/m-cheung/webidl-diff/releases{/id}","deployments_url":"https://api.github.com/repos/m-cheung/webidl-diff/deployments","created_at":"2017-05-09T19:09:17Z","updated_at":"2017-07-10T15:05:09Z","pushed_at":"2017-07-24T19:53:27Z","git_url":"git://github.com/m-cheung/webidl-diff.git","ssh_url":"git@github.com:m-cheung/webidl-diff.git","clone_url":"https://github.com/m-cheung/webidl-diff.git","svn_url":"https://github.com/m-cheung/webidl-diff","homepage":null,"size":4179,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"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":"GoogleChrome:master","ref":"master","sha":"02cb9f86d0441eff824f6bb2ce4d0e8bf845a264","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars3.githubusercontent.com/u/1778935?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":82467922,"name":"webidl-diff","full_name":"GoogleChrome/webidl-diff","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars3.githubusercontent.com/u/1778935?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/webidl-diff","description":null,"fork":false,"url":"https://api.github.com/repos/GoogleChrome/webidl-diff","forks_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/forks","keys_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/events","assignees_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/merges","archive_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/webidl-diff/deployments","created_at":"2017-02-19T15:15:42Z","updated_at":"2017-07-10T15:04:07Z","pushed_at":"2017-07-24T19:53:29Z","git_url":"git://github.com/GoogleChrome/webidl-diff.git","ssh_url":"git@github.com:GoogleChrome/webidl-diff.git","clone_url":"https://github.com/GoogleChrome/webidl-diff.git","svn_url":"https://github.com/GoogleChrome/webidl-diff","homepage":null,"size":4149,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":24,"forks":5,"open_issues":24,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/67"},"html":{"href":"https://github.com/GoogleChrome/webidl-diff/pull/67"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/issues/67"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/webidl-diff/statuses/99276f46b9a42c7908fadd24f56f611bd3aeb449"}}}}
{"actor":{"display_login":"m-cheung"}}