{"action":"opened","issue":{"url":"https://api.github.com/repos/bem/bem-xjst/issues/82","labels_url":"https://api.github.com/repos/bem/bem-xjst/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/bem/bem-xjst/issues/82/comments","events_url":"https://api.github.com/repos/bem/bem-xjst/issues/82/events","html_url":"https://github.com/bem/bem-xjst/issues/82","id":98605696,"number":82,"title":"bem-xjst@1.2: wrap() fails when used with any other mode","user":{"login":"tadatuta","id":475746,"avatar_url":"https://avatars.githubusercontent.com/u/475746?v=3","gravatar_id":"","url":"https://api.github.com/users/tadatuta","html_url":"https://github.com/tadatuta","followers_url":"https://api.github.com/users/tadatuta/followers","following_url":"https://api.github.com/users/tadatuta/following{/other_user}","gists_url":"https://api.github.com/users/tadatuta/gists{/gist_id}","starred_url":"https://api.github.com/users/tadatuta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tadatuta/subscriptions","organizations_url":"https://api.github.com/users/tadatuta/orgs","repos_url":"https://api.github.com/users/tadatuta/repos","events_url":"https://api.github.com/users/tadatuta/events{/privacy}","received_events_url":"https://api.github.com/users/tadatuta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bem/bem-xjst/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"indutny","id":238531,"avatar_url":"https://avatars.githubusercontent.com/u/238531?v=3","gravatar_id":"","url":"https://api.github.com/users/indutny","html_url":"https://github.com/indutny","followers_url":"https://api.github.com/users/indutny/followers","following_url":"https://api.github.com/users/indutny/following{/other_user}","gists_url":"https://api.github.com/users/indutny/gists{/gist_id}","starred_url":"https://api.github.com/users/indutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indutny/subscriptions","organizations_url":"https://api.github.com/users/indutny/orgs","repos_url":"https://api.github.com/users/indutny/repos","events_url":"https://api.github.com/users/indutny/events{/privacy}","received_events_url":"https://api.github.com/users/indutny/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2015-08-02T12:12:20Z","updated_at":"2015-08-02T12:12:20Z","closed_at":null,"body":"For BEMJSON `{ block: 'b1' }` and template\r\n```js\r\nblock('b1')(\r\n    tag()('span'), // can be any other mode\r\n    wrap()(function() {\r\n        return {\r\n            elem: 'wrap',\r\n            content: this.ctx\r\n        };\r\n    })\r\n);\r\n```\r\ncompilation fails with\r\n```\r\nTypeError: Cannot read property 'type' of undefined\r\n    at Controller.body.body.estraverse.replace.enter (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/lib/bemhtml/compiler.js:461:14)\r\n    at Controller.__execute (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/node_modules/estraverse/estraverse.js:318:31)\r\n    at Controller.replace (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/node_modules/estraverse/estraverse.js:493:27)\r\n    at Object.replace (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/node_modules/estraverse/estraverse.js:561:27)\r\n    at Compiler.desugarExtended (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/lib/bemhtml/compiler.js:458:26)\r\n    at Compiler.replaceBody (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/lib/bemhtml/compiler.js:562:8)\r\n    at Compiler.<anonymous> (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/lib/bemhtml/compiler.js:449:25)\r\n    at Array.map (native)\r\n    at Compiler.flatten (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/lib/bemhtml/compiler.js:441:21)\r\n    at Compiler.pretranslate (/Users/tadatuta/Sites/pr-stub-update/node_modules/enb-bemxjst/node_modules/bem-xjst/lib/bemhtml/compiler.js:122:22)\r\n```\r\n\r\nSame template works fine with `bem-xjst 4.0`."}}