| 3919 | }; |
| 3920 | |
| 3921 | function wrap(state, method, id, scope) { |
| 3922 | if (state.selfReference) { |
| 3923 | if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) { |
| 3924 | scope.rename(id.name); |
| 3925 | } else { |
| 3926 | if (!t.isFunction(method)) return; |
| 3927 | |
| 3928 | var build = buildPropertyMethodAssignmentWrapper; |
| 3929 | if (method.generator) build = buildGeneratorPropertyMethodAssignmentWrapper; |
| 3930 | var _template = build({ |
| 3931 | FUNCTION: method, |
| 3932 | FUNCTION_ID: id, |
| 3933 | FUNCTION_KEY: scope.generateUidIdentifier(id.name) |
| 3934 | }).expression; |
| 3935 | _template.callee._skipModulesRemap = true; |
| 3936 | |
| 3937 | var params = _template.callee.body.body[0].params; |
| 3938 | for (var i = 0, len = (0, _babelHelperGetFunctionArity2.default)(method); i < len; i++) { |
| 3939 | params.push(scope.generateUidIdentifier("x")); |
| 3940 | } |
| 3941 | |
| 3942 | return _template; |
| 3943 | } |
| 3944 | } |
| 3945 | |
| 3946 | method.id = id; |
| 3947 | scope.getProgramParent().references[id.name] = true; |
| 3948 | } |
| 3949 | |
| 3950 | function visit(node, name, scope) { |
| 3951 | var state = { |