{"action":"created","issue":{"url":"https://api.github.com/repos/mooz/js2-mode/issues/200","labels_url":"https://api.github.com/repos/mooz/js2-mode/issues/200/labels{/name}","comments_url":"https://api.github.com/repos/mooz/js2-mode/issues/200/comments","events_url":"https://api.github.com/repos/mooz/js2-mode/issues/200/events","html_url":"https://github.com/mooz/js2-mode/issues/200","id":55527228,"number":200,"title":"Can not parse correctly of nest functions","user":{"login":"freizl","id":437427,"avatar_url":"https://avatars.githubusercontent.com/u/437427?v=3","gravatar_id":"","url":"https://api.github.com/users/freizl","html_url":"https://github.com/freizl","followers_url":"https://api.github.com/users/freizl/followers","following_url":"https://api.github.com/users/freizl/following{/other_user}","gists_url":"https://api.github.com/users/freizl/gists{/gist_id}","starred_url":"https://api.github.com/users/freizl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freizl/subscriptions","organizations_url":"https://api.github.com/users/freizl/orgs","repos_url":"https://api.github.com/users/freizl/repos","events_url":"https://api.github.com/users/freizl/events{/privacy}","received_events_url":"https://api.github.com/users/freizl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-26T19:40:12Z","updated_at":"2015-01-26T22:56:31Z","closed_at":null,"body":"It looks good as below or just wrap with immediate function `(function ($) { ... })(jQuery)`.\r\nBut can not get `foo` and `Company` when wrap with `define(function () { ... })`, which is [requireJS](http://requirejs.org/).\r\n\r\n```\r\n\tfunction foo (a, b) {\r\n\t\treturn a+b\r\n\t}\r\n\r\n\tvar bar = function (c, d) {\r\n\t\treturn c - d\r\n\t}\r\n\r\n\tfunction Company (name) {\r\n\t\tthis.name = name\r\n\t}\r\n\r\n\tCompany.prototype.getName = function () {\r\n\t\treturn this.name\r\n\t}\r\n\tCompany.prototype.setName = function (name) {\r\n\t\tthis.name = name\r\n\t}\r\n```\r\n\r\n- Expected result when invoke `imenu`\r\n\r\n```\r\nfoo\r\nbar\r\n<definition-1>\r\ngetName\r\nsetName\r\n```\r\n\r\n- Actual result\r\n\r\n```\r\nbar\r\ngetName\r\nsetName\r\n```\r\n\r\nI'm using prelude with following extra config\r\n```\r\n(setq js2-global-externs (list \"$\" \"jQuery\" \"window\" \"document\" \"define\" \"require\"))\r\n```\r\n\r\nPlatform: Emacs 24.3.1 + ubuntu14\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mooz/js2-mode/issues/comments/71556442","html_url":"https://github.com/mooz/js2-mode/issues/200#issuecomment-71556442","issue_url":"https://api.github.com/repos/mooz/js2-mode/issues/200","id":71556442,"user":{"login":"freizl","id":437427,"avatar_url":"https://avatars.githubusercontent.com/u/437427?v=3","gravatar_id":"","url":"https://api.github.com/users/freizl","html_url":"https://github.com/freizl","followers_url":"https://api.github.com/users/freizl/followers","following_url":"https://api.github.com/users/freizl/following{/other_user}","gists_url":"https://api.github.com/users/freizl/gists{/gist_id}","starred_url":"https://api.github.com/users/freizl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freizl/subscriptions","organizations_url":"https://api.github.com/users/freizl/orgs","repos_url":"https://api.github.com/users/freizl/repos","events_url":"https://api.github.com/users/freizl/events{/privacy}","received_events_url":"https://api.github.com/users/freizl/received_events","type":"User","site_admin":false},"created_at":"2015-01-26T22:56:31Z","updated_at":"2015-01-26T22:56:31Z","body":"Add expected result and actual result. Sorry for confusion."}}