{"action":"created","comment":{"url":"https://api.github.com/repos/dglogik/calzone.dart/pulls/comments/75462872","id":75462872,"diff_hunk":"@@ -2,124 +2,188 @@ part of calzone.compiler;\n \n final RegExp _FIELD_REGEX = new RegExp(r\"[A-Za-z_0-9$]+(?=[^:A-Za-z]|$),*\");\n \n-class Class implements Renderable {\n-  final Map<String, List<Parameter>> functions = {};\n-  Map<String, dynamic> data;\n+class Class extends _SymbolTypes implements Renderable {\n+  // used by the analysis part of calzone\n+  final Map<String, List<Parameter>> functions = {}; \n+  \n+  final String name;\n+  final String libraryName;\n \n   final List<String> staticFields;\n   final List<String> getters;\n   final List<String> setters;\n \n+  // list of classes that this class inherits from\n   final List<String> inheritedFrom;\n-\n-  final String name;\n-  final String libraryName;\n+  \n+  // data from .info.json\n+  Map<String, dynamic> data;\n \n   Class(this.name, this.libraryName,\n       {this.staticFields: const [],\n       this.getters: const [],\n       this.setters: const [],\n       this.inheritedFrom: const []});\n \n+  renderDefinition(StringBuffer output, String name,\n+      StringBuffer constructor, StringBuffer prototype,\n+      List<StringBuffer> methodChecks) {\n+    \n+    output.write(\"\"\"\n+      mdex.$name = function() {\n+        $constructor\n+\n+        this[$symDartObj][$symBackup] = {};\n+        this[$symDartObj][$symJsObj] = this;\n+        \n+        var proto = mdex.$name.prototype;\n+        if(Object.getPrototypeOf(this) !== proto) {\n+    \"\"\");\n+    \n+    methodChecks.forEach((check) => output.write(check.toString()));\n+    \n+    output.write(\"\"\"\n+        }\n+      };\n+    \"\"\");\n+\n+    final proto = prototype.toString();\n+\n+    if (proto.length > 0) {\n+      // cut off trailing comma\n+      output.write(\"\"\"\n+        mdex.$name.prototype = {\n+          ${proto.substring(0, proto.length - 1)}\n+        };\n+      \"\"\");\n+    }\n+  \n+    output.write(\"mdex.$name.prototype[$symIsWrapped] = true;\");\n+\n+    output.write(\"\"\"\n+      mdex.$name.class = function() {\n+        function $name() {\n+          mdex.$name.apply(this, arguments);\n+          console.error('$name.class is deprecated, please change to only use $name');\n+        }\n+\n+        $name.prototype = Object.create(mdex.$name.prototype);\n+        $name.prototype[\"constructor\"] = $name;\n+\n+        return $name;\n+    }();\n+    \"\"\");\n+  }\n+\n   render(Compiler compiler, StringBuffer output) {\n-    List<String> names = [];\n-    List<StringBuffer> methods = [];\n+    // list of function/field names in the class\n+    final List<String> names = [];\n+    final List<StringBuffer> methods = [];\n \n-    StringBuffer constructor = new StringBuffer();\n-    StringBuffer prototype = new StringBuffer();\n-    StringBuffer global = new StringBuffer();\n+    final StringBuffer constructor = new StringBuffer();\n+    final StringBuffer prototype = new StringBuffer();\n+    final StringBuffer global = new StringBuffer();\n \n     _handleClassChildren(Class c, Map memberData, {bool isTopLevel: true}) {\n       var mangledFields =\n           compiler.mangledNames.getClassFields(c.libraryName, c.name);\n       if (mangledFields == null) mangledFields = [];\n \n-      List<String> accessors = [];\n-      Map<String, Map> getters = {};\n-      Map<String, Map> setters = {};\n+      final List<String> accessors = [];\n+      final Map<String, Map> getters = {};\n+      final Map<String, Map> setters = {};\n \n-      for (var child in memberData[\"children\"]) {\n-        child = child.split(\"/\");\n+      final List<Map<String, dynamic>> childData = memberData[\"children\"]\n+          .map((f) => compiler.info.getElement(f.split(\"/\")[0], f.split(\"/\")[1]))\n+          .toList();\n \n-        var type = child[0];\n-        var id = child[1];\n-\n-        var data = compiler.info.getElement(type, id);\n-        var name = data[\"name\"];\n+      int index = 0;\n+      for (final _ in memberData[\"children\"]) {","path":"lib/src/compiler/nodes/class.dart","position":121,"original_position":121,"commit_id":"310aa7e10cdc178336b526669f73eea7d5ee9e59","original_commit_id":"310aa7e10cdc178336b526669f73eea7d5ee9e59","user":{"login":"Pacane","id":2762440,"avatar_url":"https://avatars.githubusercontent.com/u/2762440?v=3","gravatar_id":"","url":"https://api.github.com/users/Pacane","html_url":"https://github.com/Pacane","followers_url":"https://api.github.com/users/Pacane/followers","following_url":"https://api.github.com/users/Pacane/following{/other_user}","gists_url":"https://api.github.com/users/Pacane/gists{/gist_id}","starred_url":"https://api.github.com/users/Pacane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pacane/subscriptions","organizations_url":"https://api.github.com/users/Pacane/orgs","repos_url":"https://api.github.com/users/Pacane/repos","events_url":"https://api.github.com/users/Pacane/events{/privacy}","received_events_url":"https://api.github.com/users/Pacane/received_events","type":"User","site_admin":false},"body":"this could be done with a regular for","created_at":"2016-08-19T10:53:23Z","updated_at":"2016-08-19T10:53:23Z","html_url":"https://github.com/dglogik/calzone.dart/pull/5#discussion_r75462872","pull_request_url":"https://api.github.com/repos/dglogik/calzone.dart/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/dglogik/calzone.dart/pulls/comments/75462872"},"html":{"href":"https://github.com/dglogik/calzone.dart/pull/5#discussion_r75462872"},"pull_request":{"href":"https://api.github.com/repos/dglogik/calzone.dart/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/dglogik/calzone.dart/pulls/5","id":81929498,"html_url":"https://github.com/dglogik/calzone.dart/pull/5","diff_url":"https://github.com/dglogik/calzone.dart/pull/5.diff","patch_url":"https://github.com/dglogik/calzone.dart/pull/5.patch","issue_url":"https://api.github.com/repos/dglogik/calzone.dart/issues/5","number":5,"state":"open","locked":false,"title":"Clean up the class generator.","user":{"login":"mbullington","id":6068785,"avatar_url":"https://avatars.githubusercontent.com/u/6068785?v=3","gravatar_id":"","url":"https://api.github.com/users/mbullington","html_url":"https://github.com/mbullington","followers_url":"https://api.github.com/users/mbullington/followers","following_url":"https://api.github.com/users/mbullington/following{/other_user}","gists_url":"https://api.github.com/users/mbullington/gists{/gist_id}","starred_url":"https://api.github.com/users/mbullington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbullington/subscriptions","organizations_url":"https://api.github.com/users/mbullington/orgs","repos_url":"https://api.github.com/users/mbullington/repos","events_url":"https://api.github.com/users/mbullington/events{/privacy}","received_events_url":"https://api.github.com/users/mbullington/received_events","type":"User","site_admin":false},"body":"I didn't break rendering into their own methods (yet) because of the large amount of variables that needed to be passed as parameters to each one. That may change in the future.","created_at":"2016-08-19T05:47:23Z","updated_at":"2016-08-19T10:53:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02150dbad250be0cfbe27b4d1cd15a21f5a561c0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dglogik/calzone.dart/pulls/5/commits","review_comments_url":"https://api.github.com/repos/dglogik/calzone.dart/pulls/5/comments","review_comment_url":"https://api.github.com/repos/dglogik/calzone.dart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dglogik/calzone.dart/issues/5/comments","statuses_url":"https://api.github.com/repos/dglogik/calzone.dart/statuses/310aa7e10cdc178336b526669f73eea7d5ee9e59","head":{"label":"mbullington:master","ref":"master","sha":"310aa7e10cdc178336b526669f73eea7d5ee9e59","user":{"login":"mbullington","id":6068785,"avatar_url":"https://avatars.githubusercontent.com/u/6068785?v=3","gravatar_id":"","url":"https://api.github.com/users/mbullington","html_url":"https://github.com/mbullington","followers_url":"https://api.github.com/users/mbullington/followers","following_url":"https://api.github.com/users/mbullington/following{/other_user}","gists_url":"https://api.github.com/users/mbullington/gists{/gist_id}","starred_url":"https://api.github.com/users/mbullington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbullington/subscriptions","organizations_url":"https://api.github.com/users/mbullington/orgs","repos_url":"https://api.github.com/users/mbullington/repos","events_url":"https://api.github.com/users/mbullington/events{/privacy}","received_events_url":"https://api.github.com/users/mbullington/received_events","type":"User","site_admin":false},"repo":{"id":66031331,"name":"calzone.dart","full_name":"mbullington/calzone.dart","owner":{"login":"mbullington","id":6068785,"avatar_url":"https://avatars.githubusercontent.com/u/6068785?v=3","gravatar_id":"","url":"https://api.github.com/users/mbullington","html_url":"https://github.com/mbullington","followers_url":"https://api.github.com/users/mbullington/followers","following_url":"https://api.github.com/users/mbullington/following{/other_user}","gists_url":"https://api.github.com/users/mbullington/gists{/gist_id}","starred_url":"https://api.github.com/users/mbullington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbullington/subscriptions","organizations_url":"https://api.github.com/users/mbullington/orgs","repos_url":"https://api.github.com/users/mbullington/repos","events_url":"https://api.github.com/users/mbullington/events{/privacy}","received_events_url":"https://api.github.com/users/mbullington/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mbullington/calzone.dart","description":"Use Dart libraries from JavaScript.","fork":true,"url":"https://api.github.com/repos/mbullington/calzone.dart","forks_url":"https://api.github.com/repos/mbullington/calzone.dart/forks","keys_url":"https://api.github.com/repos/mbullington/calzone.dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mbullington/calzone.dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mbullington/calzone.dart/teams","hooks_url":"https://api.github.com/repos/mbullington/calzone.dart/hooks","issue_events_url":"https://api.github.com/repos/mbullington/calzone.dart/issues/events{/number}","events_url":"https://api.github.com/repos/mbullington/calzone.dart/events","assignees_url":"https://api.github.com/repos/mbullington/calzone.dart/assignees{/user}","branches_url":"https://api.github.com/repos/mbullington/calzone.dart/branches{/branch}","tags_url":"https://api.github.com/repos/mbullington/calzone.dart/tags","blobs_url":"https://api.github.com/repos/mbullington/calzone.dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mbullington/calzone.dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mbullington/calzone.dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/mbullington/calzone.dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mbullington/calzone.dart/statuses/{sha}","languages_url":"https://api.github.com/repos/mbullington/calzone.dart/languages","stargazers_url":"https://api.github.com/repos/mbullington/calzone.dart/stargazers","contributors_url":"https://api.github.com/repos/mbullington/calzone.dart/contributors","subscribers_url":"https://api.github.com/repos/mbullington/calzone.dart/subscribers","subscription_url":"https://api.github.com/repos/mbullington/calzone.dart/subscription","commits_url":"https://api.github.com/repos/mbullington/calzone.dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/mbullington/calzone.dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/mbullington/calzone.dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/mbullington/calzone.dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/mbullington/calzone.dart/contents/{+path}","compare_url":"https://api.github.com/repos/mbullington/calzone.dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mbullington/calzone.dart/merges","archive_url":"https://api.github.com/repos/mbullington/calzone.dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mbullington/calzone.dart/downloads","issues_url":"https://api.github.com/repos/mbullington/calzone.dart/issues{/number}","pulls_url":"https://api.github.com/repos/mbullington/calzone.dart/pulls{/number}","milestones_url":"https://api.github.com/repos/mbullington/calzone.dart/milestones{/number}","notifications_url":"https://api.github.com/repos/mbullington/calzone.dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mbullington/calzone.dart/labels{/name}","releases_url":"https://api.github.com/repos/mbullington/calzone.dart/releases{/id}","deployments_url":"https://api.github.com/repos/mbullington/calzone.dart/deployments","created_at":"2016-08-18T21:17:16Z","updated_at":"2016-08-18T21:17:17Z","pushed_at":"2016-08-19T05:33:20Z","git_url":"git://github.com/mbullington/calzone.dart.git","ssh_url":"git@github.com:mbullington/calzone.dart.git","clone_url":"https://github.com/mbullington/calzone.dart.git","svn_url":"https://github.com/mbullington/calzone.dart","homepage":null,"size":195,"stargazers_count":0,"watchers_count":0,"language":"Dart","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":"dglogik:master","ref":"master","sha":"28e93c39e50659afd6605cb219f1c0830a9e50b6","user":{"login":"dglogik","id":2438450,"avatar_url":"https://avatars.githubusercontent.com/u/2438450?v=3","gravatar_id":"","url":"https://api.github.com/users/dglogik","html_url":"https://github.com/dglogik","followers_url":"https://api.github.com/users/dglogik/followers","following_url":"https://api.github.com/users/dglogik/following{/other_user}","gists_url":"https://api.github.com/users/dglogik/gists{/gist_id}","starred_url":"https://api.github.com/users/dglogik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dglogik/subscriptions","organizations_url":"https://api.github.com/users/dglogik/orgs","repos_url":"https://api.github.com/users/dglogik/repos","events_url":"https://api.github.com/users/dglogik/events{/privacy}","received_events_url":"https://api.github.com/users/dglogik/received_events","type":"User","site_admin":false},"repo":{"id":36243598,"name":"calzone.dart","full_name":"dglogik/calzone.dart","owner":{"login":"dglogik","id":2438450,"avatar_url":"https://avatars.githubusercontent.com/u/2438450?v=3","gravatar_id":"","url":"https://api.github.com/users/dglogik","html_url":"https://github.com/dglogik","followers_url":"https://api.github.com/users/dglogik/followers","following_url":"https://api.github.com/users/dglogik/following{/other_user}","gists_url":"https://api.github.com/users/dglogik/gists{/gist_id}","starred_url":"https://api.github.com/users/dglogik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dglogik/subscriptions","organizations_url":"https://api.github.com/users/dglogik/orgs","repos_url":"https://api.github.com/users/dglogik/repos","events_url":"https://api.github.com/users/dglogik/events{/privacy}","received_events_url":"https://api.github.com/users/dglogik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dglogik/calzone.dart","description":"Use Dart libraries from JavaScript.","fork":false,"url":"https://api.github.com/repos/dglogik/calzone.dart","forks_url":"https://api.github.com/repos/dglogik/calzone.dart/forks","keys_url":"https://api.github.com/repos/dglogik/calzone.dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dglogik/calzone.dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dglogik/calzone.dart/teams","hooks_url":"https://api.github.com/repos/dglogik/calzone.dart/hooks","issue_events_url":"https://api.github.com/repos/dglogik/calzone.dart/issues/events{/number}","events_url":"https://api.github.com/repos/dglogik/calzone.dart/events","assignees_url":"https://api.github.com/repos/dglogik/calzone.dart/assignees{/user}","branches_url":"https://api.github.com/repos/dglogik/calzone.dart/branches{/branch}","tags_url":"https://api.github.com/repos/dglogik/calzone.dart/tags","blobs_url":"https://api.github.com/repos/dglogik/calzone.dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dglogik/calzone.dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dglogik/calzone.dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/dglogik/calzone.dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dglogik/calzone.dart/statuses/{sha}","languages_url":"https://api.github.com/repos/dglogik/calzone.dart/languages","stargazers_url":"https://api.github.com/repos/dglogik/calzone.dart/stargazers","contributors_url":"https://api.github.com/repos/dglogik/calzone.dart/contributors","subscribers_url":"https://api.github.com/repos/dglogik/calzone.dart/subscribers","subscription_url":"https://api.github.com/repos/dglogik/calzone.dart/subscription","commits_url":"https://api.github.com/repos/dglogik/calzone.dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/dglogik/calzone.dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/dglogik/calzone.dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/dglogik/calzone.dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/dglogik/calzone.dart/contents/{+path}","compare_url":"https://api.github.com/repos/dglogik/calzone.dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dglogik/calzone.dart/merges","archive_url":"https://api.github.com/repos/dglogik/calzone.dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dglogik/calzone.dart/downloads","issues_url":"https://api.github.com/repos/dglogik/calzone.dart/issues{/number}","pulls_url":"https://api.github.com/repos/dglogik/calzone.dart/pulls{/number}","milestones_url":"https://api.github.com/repos/dglogik/calzone.dart/milestones{/number}","notifications_url":"https://api.github.com/repos/dglogik/calzone.dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dglogik/calzone.dart/labels{/name}","releases_url":"https://api.github.com/repos/dglogik/calzone.dart/releases{/id}","deployments_url":"https://api.github.com/repos/dglogik/calzone.dart/deployments","created_at":"2015-05-25T17:04:50Z","updated_at":"2016-05-02T15:49:25Z","pushed_at":"2016-08-19T05:47:24Z","git_url":"git://github.com/dglogik/calzone.dart.git","ssh_url":"git@github.com:dglogik/calzone.dart.git","clone_url":"https://github.com/dglogik/calzone.dart.git","svn_url":"https://github.com/dglogik/calzone.dart","homepage":null,"size":244,"stargazers_count":4,"watchers_count":4,"language":"Dart","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dglogik/calzone.dart/pulls/5"},"html":{"href":"https://github.com/dglogik/calzone.dart/pull/5"},"issue":{"href":"https://api.github.com/repos/dglogik/calzone.dart/issues/5"},"comments":{"href":"https://api.github.com/repos/dglogik/calzone.dart/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/dglogik/calzone.dart/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/dglogik/calzone.dart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dglogik/calzone.dart/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/dglogik/calzone.dart/statuses/310aa7e10cdc178336b526669f73eea7d5ee9e59"}}}}
{"actor":{"display_login":"Pacane"}}