MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / inferBindContext

Function inferBindContext

scripts/babel-plugin-safe-bind.js:56–68  ·  view source on GitHub ↗
(bind, scope)

Source from the content-addressed store, hash-verified

54 }
55
56 function inferBindContext(bind, scope) {
57 const staticContext = getStaticContext(bind, scope);
58 if (staticContext) return _core.types.cloneNode(staticContext);
59 const tempId = getTempId(scope);
60
61 if (bind.object) {
62 bind.callee = _core.types.sequenceExpression([_core.types.assignmentExpression("=", tempId, bind.object), bind.callee]);
63 } else {
64 bind.callee.object = _core.types.assignmentExpression("=", tempId, bind.callee.object);
65 }
66
67 return _core.types.cloneNode(tempId);
68 }
69
70 return {
71 name: "safe-function-bind",

Callers 1

BindExpressionFunction · 0.85

Calls 2

getStaticContextFunction · 0.85
getTempIdFunction · 0.85

Tested by

no test coverage detected