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

Function checkAndReportErrorForMissingPrefix

test/fixtures/snapshot/typescript.js:50135–50166  ·  view source on GitHub ↗
(errorLocation, name, nameArg)

Source from the content-addressed store, hash-verified

50133 return false;
50134 }
50135 function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
50136 if (!ts.isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) {
50137 return false;
50138 }
50139 var container = ts.getThisContainer(errorLocation, /*includeArrowFunctions*/ false);
50140 var location = container;
50141 while (location) {
50142 if (ts.isClassLike(location.parent)) {
50143 var classSymbol = getSymbolOfNode(location.parent);
50144 if (!classSymbol) {
50145 break;
50146 }
50147 // Check to see if a static member exists.
50148 var constructorType = getTypeOfSymbol(classSymbol);
50149 if (getPropertyOfType(constructorType, name)) {
50150 error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol));
50151 return true;
50152 }
50153 // No static member is present.
50154 // Check if we're in an instance method and look for a relevant instance member.
50155 if (location === container && !ts.isStatic(location)) {
50156 var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; // TODO: GH#18217
50157 if (getPropertyOfType(instanceType, name)) {
50158 error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg));
50159 return true;
50160 }
50161 }
50162 }
50163 location = location.parent;
50164 }
50165 return false;
50166 }
50167 function checkAndReportErrorForExtendingInterface(errorLocation) {
50168 var expression = getEntityNameForExtendingInterface(errorLocation);
50169 if (expression && resolveEntityName(expression, 64 /* SymbolFlags.Interface */, /*ignoreErrors*/ true)) {

Callers 1

resolveNameHelperFunction · 0.85

Calls 9

isInTypeQueryFunction · 0.85
getSymbolOfNodeFunction · 0.85
getTypeOfSymbolFunction · 0.85
getPropertyOfTypeFunction · 0.85
diagnosticNameFunction · 0.85
symbolToStringFunction · 0.85
getDeclaredTypeOfSymbolFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected