MCPcopy Create free account
hub / github.com/nodejs/node / checkIfThisIsCapturedInEnclosingScope

Function checkIfThisIsCapturedInEnclosingScope

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

Source from the content-addressed store, hash-verified

82295 }
82296 // this function will run after checking the source file so 'CaptureThis' is correct for all nodes
82297 function checkIfThisIsCapturedInEnclosingScope(node) {
82298 ts.findAncestor(node, function (current) {
82299 if (getNodeCheckFlags(current) & 4 /* NodeCheckFlags.CaptureThis */) {
82300 var isDeclaration_1 = node.kind !== 79 /* SyntaxKind.Identifier */;
82301 if (isDeclaration_1) {
82302 error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
82303 }
82304 else {
82305 error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference);
82306 }
82307 return true;
82308 }
82309 return false;
82310 });
82311 }
82312 function checkIfNewTargetIsCapturedInEnclosingScope(node) {
82313 ts.findAncestor(node, function (current) {
82314 if (getNodeCheckFlags(current) & 8 /* NodeCheckFlags.CaptureNewTarget */) {

Callers

nothing calls this directly

Calls 2

getNodeCheckFlagsFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected