MCPcopy Index your code
hub / github.com/nodejs/node / createCallBinding

Function createCallBinding

test/fixtures/snapshot/typescript.js:26814–26863  ·  view source on GitHub ↗
(expression, recordTempVariable, languageVersion, cacheIdentifiers)

Source from the content-addressed store, hash-verified

26812 }
26813 }
26814 function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) {
26815 if (cacheIdentifiers === void 0) { cacheIdentifiers = false; }
26816 var callee = ts.skipOuterExpressions(expression, 15 /* OuterExpressionKinds.All */);
26817 var thisArg;
26818 var target;
26819 if (ts.isSuperProperty(callee)) {
26820 thisArg = createThis();
26821 target = callee;
26822 }
26823 else if (ts.isSuperKeyword(callee)) {
26824 thisArg = createThis();
26825 target = languageVersion !== undefined && languageVersion < 2 /* ScriptTarget.ES2015 */
26826 ? ts.setTextRange(createIdentifier("_super"), callee)
26827 : callee;
26828 }
26829 else if (ts.getEmitFlags(callee) & 4096 /* EmitFlags.HelperName */) {
26830 thisArg = createVoidZero();
26831 target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee);
26832 }
26833 else if (ts.isPropertyAccessExpression(callee)) {
26834 if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
26835 // for `a.b()` target is `(_a = a).b` and thisArg is `_a`
26836 thisArg = createTempVariable(recordTempVariable);
26837 target = createPropertyAccessExpression(ts.setTextRange(factory.createAssignment(thisArg, callee.expression), callee.expression), callee.name);
26838 ts.setTextRange(target, callee);
26839 }
26840 else {
26841 thisArg = callee.expression;
26842 target = callee;
26843 }
26844 }
26845 else if (ts.isElementAccessExpression(callee)) {
26846 if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
26847 // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
26848 thisArg = createTempVariable(recordTempVariable);
26849 target = createElementAccessExpression(ts.setTextRange(factory.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression);
26850 ts.setTextRange(target, callee);
26851 }
26852 else {
26853 thisArg = callee.expression;
26854 target = callee;
26855 }
26856 }
26857 else {
26858 // for `a()` target is `a` and thisArg is `void 0`
26859 thisArg = createVoidZero();
26860 target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
26861 }
26862 return { target: target, thisArg: thisArg };
26863 }
26864 function createAssignmentTargetWrapper(paramName, expression) {
26865 return createPropertyAccessExpression(
26866 // Explicit parens required because of v8 regression (https://bugs.chromium.org/p/v8/issues/detail?id=9560)

Callers

nothing calls this directly

Calls 7

createThisFunction · 0.85
createIdentifierFunction · 0.85
createVoidZeroFunction · 0.85
createTempVariableFunction · 0.85

Tested by

no test coverage detected