{"action":"created","comment":{"url":"https://api.github.com/repos/juttle/juttle/pulls/comments/57321617","id":57321617,"diff_hunk":"@@ -207,6 +229,18 @@ class Build extends CodeGenerator {\n             self.gen_statement(stmt, {path_info: {mod: node.name, sub: []}});\n         } );\n     }\n+    gen_NativeModuleDef(node) {\n+        //\n+        // just spit out the module elements in the main scope since\n+        // the semantic pass flattened out all the module contents\n+        // with unames\n+        //\n+        var self = this;\n+        this.emit(`var ${node.uname} = builder.native_module(\"${node.uname}\", \"${node.name}\", ${JSON.stringify(node.source)});\\n`);\n+        _.each(node.elements, function(stmt) {\n+            self.gen_statement(stmt, {path_info: {mod: node.name, sub: []}});\n+        } );","path":"lib/compiler/build.js","position":59,"original_position":59,"commit_id":"decb8fa2d479c0abd63af4f4d9493dfe2d96ac98","original_commit_id":"decb8fa2d479c0abd63af4f4d9493dfe2d96ac98","user":{"login":"dmajda","id":18821,"avatar_url":"https://avatars.githubusercontent.com/u/18821?v=3","gravatar_id":"","url":"https://api.github.com/users/dmajda","html_url":"https://github.com/dmajda","followers_url":"https://api.github.com/users/dmajda/followers","following_url":"https://api.github.com/users/dmajda/following{/other_user}","gists_url":"https://api.github.com/users/dmajda/gists{/gist_id}","starred_url":"https://api.github.com/users/dmajda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmajda/subscriptions","organizations_url":"https://api.github.com/users/dmajda/orgs","repos_url":"https://api.github.com/users/dmajda/repos","events_url":"https://api.github.com/users/dmajda/events{/privacy}","received_events_url":"https://api.github.com/users/dmajda/received_events","type":"User","site_admin":false},"body":"The loop over `node.elements` is not needed (native module doesn’t have any).","created_at":"2016-03-24T14:12:51Z","updated_at":"2016-03-24T14:12:51Z","html_url":"https://github.com/juttle/juttle/pull/624#discussion_r57321617","pull_request_url":"https://api.github.com/repos/juttle/juttle/pulls/624","_links":{"self":{"href":"https://api.github.com/repos/juttle/juttle/pulls/comments/57321617"},"html":{"href":"https://github.com/juttle/juttle/pull/624#discussion_r57321617"},"pull_request":{"href":"https://api.github.com/repos/juttle/juttle/pulls/624"}}},"pull_request":{"url":"https://api.github.com/repos/juttle/juttle/pulls/624","id":63324505,"html_url":"https://github.com/juttle/juttle/pull/624","diff_url":"https://github.com/juttle/juttle/pull/624.diff","patch_url":"https://github.com/juttle/juttle/pull/624.patch","issue_url":"https://api.github.com/repos/juttle/juttle/issues/624","number":624,"state":"open","locked":false,"title":"modules: support importing procs from native js modules","user":{"login":"demmer","id":3308504,"avatar_url":"https://avatars.githubusercontent.com/u/3308504?v=3","gravatar_id":"","url":"https://api.github.com/users/demmer","html_url":"https://github.com/demmer","followers_url":"https://api.github.com/users/demmer/followers","following_url":"https://api.github.com/users/demmer/following{/other_user}","gists_url":"https://api.github.com/users/demmer/gists{/gist_id}","starred_url":"https://api.github.com/users/demmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/demmer/subscriptions","organizations_url":"https://api.github.com/users/demmer/orgs","repos_url":"https://api.github.com/users/demmer/repos","events_url":"https://api.github.com/users/demmer/events{/privacy}","received_events_url":"https://api.github.com/users/demmer/received_events","type":"User","site_admin":false},"body":"This adds rudimentary support for extending the runtime with procs\r\nimplemented in javascript by supporting `import \"/path/to/file.js\"`\r\nin which the file exports an object containing the proc implementation.\r\n\r\nTo make this work, the module loader looks at the file extension, and for\r\n.js files it simply inlines the source and returns it.\r\n\r\nThen the semantic pass evals the blob of code and puts all the symbols from\r\nthe exported `procs` into scope.\r\n\r\nThe flowgraph builder generates a new type of natice proc call node and also\r\npasses through the native modules so they can be carried through to the\r\nbuilt flowgraph.\r\n\r\nFinally, the module source is inlined into the compiled code so it gets\r\nevaluated again as part of the program itself.","created_at":"2016-03-18T03:44:28Z","updated_at":"2016-03-24T14:12:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"382bcd24c4966728b2711bbee549a659e4755b3f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/juttle/juttle/pulls/624/commits","review_comments_url":"https://api.github.com/repos/juttle/juttle/pulls/624/comments","review_comment_url":"https://api.github.com/repos/juttle/juttle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juttle/juttle/issues/624/comments","statuses_url":"https://api.github.com/repos/juttle/juttle/statuses/decb8fa2d479c0abd63af4f4d9493dfe2d96ac98","head":{"label":"juttle:native-modules","ref":"native-modules","sha":"decb8fa2d479c0abd63af4f4d9493dfe2d96ac98","user":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"repo":{"id":48260003,"name":"juttle","full_name":"juttle/juttle","owner":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juttle/juttle","description":"Juttle dataflow programming language","fork":false,"url":"https://api.github.com/repos/juttle/juttle","forks_url":"https://api.github.com/repos/juttle/juttle/forks","keys_url":"https://api.github.com/repos/juttle/juttle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juttle/juttle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juttle/juttle/teams","hooks_url":"https://api.github.com/repos/juttle/juttle/hooks","issue_events_url":"https://api.github.com/repos/juttle/juttle/issues/events{/number}","events_url":"https://api.github.com/repos/juttle/juttle/events","assignees_url":"https://api.github.com/repos/juttle/juttle/assignees{/user}","branches_url":"https://api.github.com/repos/juttle/juttle/branches{/branch}","tags_url":"https://api.github.com/repos/juttle/juttle/tags","blobs_url":"https://api.github.com/repos/juttle/juttle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juttle/juttle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juttle/juttle/git/refs{/sha}","trees_url":"https://api.github.com/repos/juttle/juttle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juttle/juttle/statuses/{sha}","languages_url":"https://api.github.com/repos/juttle/juttle/languages","stargazers_url":"https://api.github.com/repos/juttle/juttle/stargazers","contributors_url":"https://api.github.com/repos/juttle/juttle/contributors","subscribers_url":"https://api.github.com/repos/juttle/juttle/subscribers","subscription_url":"https://api.github.com/repos/juttle/juttle/subscription","commits_url":"https://api.github.com/repos/juttle/juttle/commits{/sha}","git_commits_url":"https://api.github.com/repos/juttle/juttle/git/commits{/sha}","comments_url":"https://api.github.com/repos/juttle/juttle/comments{/number}","issue_comment_url":"https://api.github.com/repos/juttle/juttle/issues/comments{/number}","contents_url":"https://api.github.com/repos/juttle/juttle/contents/{+path}","compare_url":"https://api.github.com/repos/juttle/juttle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juttle/juttle/merges","archive_url":"https://api.github.com/repos/juttle/juttle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juttle/juttle/downloads","issues_url":"https://api.github.com/repos/juttle/juttle/issues{/number}","pulls_url":"https://api.github.com/repos/juttle/juttle/pulls{/number}","milestones_url":"https://api.github.com/repos/juttle/juttle/milestones{/number}","notifications_url":"https://api.github.com/repos/juttle/juttle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juttle/juttle/labels{/name}","releases_url":"https://api.github.com/repos/juttle/juttle/releases{/id}","deployments_url":"https://api.github.com/repos/juttle/juttle/deployments","created_at":"2015-12-18T22:50:40Z","updated_at":"2016-03-24T03:25:48Z","pushed_at":"2016-03-24T12:52:20Z","git_url":"git://github.com/juttle/juttle.git","ssh_url":"git@github.com:juttle/juttle.git","clone_url":"https://github.com/juttle/juttle.git","svn_url":"https://github.com/juttle/juttle","homepage":"http://juttle.github.io/","size":5748,"stargazers_count":145,"watchers_count":145,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":121,"forks":9,"open_issues":121,"watchers":145,"default_branch":"master"}},"base":{"label":"juttle:master","ref":"master","sha":"df1267c77a7e50d5dfeff4b100d0e5b73bac80ad","user":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"repo":{"id":48260003,"name":"juttle","full_name":"juttle/juttle","owner":{"login":"juttle","id":8988633,"avatar_url":"https://avatars.githubusercontent.com/u/8988633?v=3","gravatar_id":"","url":"https://api.github.com/users/juttle","html_url":"https://github.com/juttle","followers_url":"https://api.github.com/users/juttle/followers","following_url":"https://api.github.com/users/juttle/following{/other_user}","gists_url":"https://api.github.com/users/juttle/gists{/gist_id}","starred_url":"https://api.github.com/users/juttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juttle/subscriptions","organizations_url":"https://api.github.com/users/juttle/orgs","repos_url":"https://api.github.com/users/juttle/repos","events_url":"https://api.github.com/users/juttle/events{/privacy}","received_events_url":"https://api.github.com/users/juttle/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juttle/juttle","description":"Juttle dataflow programming language","fork":false,"url":"https://api.github.com/repos/juttle/juttle","forks_url":"https://api.github.com/repos/juttle/juttle/forks","keys_url":"https://api.github.com/repos/juttle/juttle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juttle/juttle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juttle/juttle/teams","hooks_url":"https://api.github.com/repos/juttle/juttle/hooks","issue_events_url":"https://api.github.com/repos/juttle/juttle/issues/events{/number}","events_url":"https://api.github.com/repos/juttle/juttle/events","assignees_url":"https://api.github.com/repos/juttle/juttle/assignees{/user}","branches_url":"https://api.github.com/repos/juttle/juttle/branches{/branch}","tags_url":"https://api.github.com/repos/juttle/juttle/tags","blobs_url":"https://api.github.com/repos/juttle/juttle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juttle/juttle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juttle/juttle/git/refs{/sha}","trees_url":"https://api.github.com/repos/juttle/juttle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juttle/juttle/statuses/{sha}","languages_url":"https://api.github.com/repos/juttle/juttle/languages","stargazers_url":"https://api.github.com/repos/juttle/juttle/stargazers","contributors_url":"https://api.github.com/repos/juttle/juttle/contributors","subscribers_url":"https://api.github.com/repos/juttle/juttle/subscribers","subscription_url":"https://api.github.com/repos/juttle/juttle/subscription","commits_url":"https://api.github.com/repos/juttle/juttle/commits{/sha}","git_commits_url":"https://api.github.com/repos/juttle/juttle/git/commits{/sha}","comments_url":"https://api.github.com/repos/juttle/juttle/comments{/number}","issue_comment_url":"https://api.github.com/repos/juttle/juttle/issues/comments{/number}","contents_url":"https://api.github.com/repos/juttle/juttle/contents/{+path}","compare_url":"https://api.github.com/repos/juttle/juttle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juttle/juttle/merges","archive_url":"https://api.github.com/repos/juttle/juttle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juttle/juttle/downloads","issues_url":"https://api.github.com/repos/juttle/juttle/issues{/number}","pulls_url":"https://api.github.com/repos/juttle/juttle/pulls{/number}","milestones_url":"https://api.github.com/repos/juttle/juttle/milestones{/number}","notifications_url":"https://api.github.com/repos/juttle/juttle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juttle/juttle/labels{/name}","releases_url":"https://api.github.com/repos/juttle/juttle/releases{/id}","deployments_url":"https://api.github.com/repos/juttle/juttle/deployments","created_at":"2015-12-18T22:50:40Z","updated_at":"2016-03-24T03:25:48Z","pushed_at":"2016-03-24T12:52:20Z","git_url":"git://github.com/juttle/juttle.git","ssh_url":"git@github.com:juttle/juttle.git","clone_url":"https://github.com/juttle/juttle.git","svn_url":"https://github.com/juttle/juttle","homepage":"http://juttle.github.io/","size":5748,"stargazers_count":145,"watchers_count":145,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":121,"forks":9,"open_issues":121,"watchers":145,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/juttle/juttle/pulls/624"},"html":{"href":"https://github.com/juttle/juttle/pull/624"},"issue":{"href":"https://api.github.com/repos/juttle/juttle/issues/624"},"comments":{"href":"https://api.github.com/repos/juttle/juttle/issues/624/comments"},"review_comments":{"href":"https://api.github.com/repos/juttle/juttle/pulls/624/comments"},"review_comment":{"href":"https://api.github.com/repos/juttle/juttle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juttle/juttle/pulls/624/commits"},"statuses":{"href":"https://api.github.com/repos/juttle/juttle/statuses/decb8fa2d479c0abd63af4f4d9493dfe2d96ac98"}}}}