MCPcopy Create free account
hub / github.com/RubyLouvre/anu / wrap

Function wrap

test/babel.js:3921–3948  ·  view source on GitHub ↗
(state, method, id, scope)

Source from the content-addressed store, hash-verified

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 = {

Callers 2

babel.jsFile · 0.85
updateFunction · 0.85

Calls 1

buildFunction · 0.85

Tested by

no test coverage detected