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

Function bindSpecialPropertyAssignment

test/fixtures/snapshot/typescript.js:47330–47358  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

47328 bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false);
47329 }
47330 function bindSpecialPropertyAssignment(node) {
47331 var _a;
47332 // Class declarations in Typescript do not allow property declarations
47333 var parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer);
47334 if (!ts.isInJSFile(node) && !ts.isFunctionSymbol(parentSymbol)) {
47335 return;
47336 }
47337 var rootExpr = ts.getLeftmostAccessExpression(node.left);
47338 if (ts.isIdentifier(rootExpr) && ((_a = lookupSymbolForName(container, rootExpr.escapedText)) === null || _a === void 0 ? void 0 : _a.flags) & 2097152 /* SymbolFlags.Alias */) {
47339 return;
47340 }
47341 // Fix up parent pointers since we're going to use these nodes before we bind into them
47342 ts.setParent(node.left, node);
47343 ts.setParent(node.right, node);
47344 if (ts.isIdentifier(node.left.expression) && container === file && isExportsOrModuleExportsOrAlias(file, node.left.expression)) {
47345 // This can be an alias for the 'exports' or 'module.exports' names, e.g.
47346 // var util = module.exports;
47347 // util.property = function ...
47348 bindExportsPropertyAssignment(node);
47349 }
47350 else if (ts.hasDynamicName(node)) {
47351 bindAnonymousDeclaration(node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, "__computed" /* InternalSymbolName.Computed */);
47352 var sym = bindPotentiallyMissingNamespaces(parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), /*isPrototype*/ false, /*containerIsClass*/ false);
47353 addLateBoundAssignmentDeclarationToSymbol(node, sym);
47354 }
47355 else {
47356 bindStaticPropertyAssignment(ts.cast(node.left, ts.isBindableStaticNameExpression));
47357 }
47358 }
47359 /**
47360 * For nodes like `x.y = z`, declare a member 'y' on 'x' if x is a function (or IIFE) or class or {}, or not declared.
47361 * Also works for expression statements preceded by JSDoc, like / ** @type number * / x.y;

Callers 1

bindWorkerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…