@@ -1827,6 +1827,7 @@ namespace ts {
1827
1827
* the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
1828
1828
* the given name can be found.
1829
1829
*
1830
+ * @param nameNotFoundMessage If defined, we will report errors found during resolve.
1830
1831
* @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
1831
1832
*/
1832
1833
function resolveName(
@@ -1837,9 +1838,8 @@ namespace ts {
1837
1838
nameArg: __String | Identifier | undefined,
1838
1839
isUse: boolean,
1839
1840
excludeGlobals = false,
1840
- getSpellingSuggestions = true,
1841
- reportErrors = true): Symbol | undefined {
1842
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol, reportErrors);
1841
+ getSpellingSuggestions = true): Symbol | undefined {
1842
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
1843
1843
}
1844
1844
1845
1845
function resolveNameHelper(
@@ -1851,8 +1851,7 @@ namespace ts {
1851
1851
isUse: boolean,
1852
1852
excludeGlobals: boolean,
1853
1853
getSpellingSuggestions: boolean,
1854
- lookup: typeof getSymbol,
1855
- reportErrors = true): Symbol | undefined {
1854
+ lookup: typeof getSymbol): Symbol | undefined {
1856
1855
const originalLocation = location; // needed for did-you-mean error reporting, which gathers candidates starting from the original location
1857
1856
let result: Symbol | undefined;
1858
1857
let lastLocation: Node | undefined;
@@ -2013,7 +2012,7 @@ namespace ts {
2013
2012
// TypeScript 1.0 spec (April 2014): 3.4.1
2014
2013
// The scope of a type parameter extends over the entire declaration with which the type
2015
2014
// parameter list is associated, with the exception of static member declarations in classes.
2016
- if (reportErrors ) {
2015
+ if (nameNotFoundMessage ) {
2017
2016
error(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
2018
2017
}
2019
2018
return undefined;
@@ -2033,7 +2032,7 @@ namespace ts {
2033
2032
if (lastLocation === (location as ExpressionWithTypeArguments).expression && (location.parent as HeritageClause).token === SyntaxKind.ExtendsKeyword) {
2034
2033
const container = location.parent.parent;
2035
2034
if (isClassLike(container) && (result = lookup(getSymbolOfNode(container).members!, name, meaning & SymbolFlags.Type))) {
2036
- if (reportErrors && nameNotFoundMessage) {
2035
+ if (nameNotFoundMessage) {
2037
2036
error(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
2038
2037
}
2039
2038
return undefined;
@@ -2053,7 +2052,7 @@ namespace ts {
2053
2052
if (isClassLike(grandparent) || grandparent.kind === SyntaxKind.InterfaceDeclaration) {
2054
2053
// A reference to this grandparent's type parameters would be an error
2055
2054
if (result = lookup(getSymbolOfNode(grandparent as ClassLikeDeclaration | InterfaceDeclaration).members!, name, meaning & SymbolFlags.Type)) {
2056
- if (reportErrors ) {
2055
+ if (nameNotFoundMessage ) {
2057
2056
error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
2058
2057
}
2059
2058
return undefined;
@@ -2212,7 +2211,7 @@ namespace ts {
2212
2211
}
2213
2212
2214
2213
if (!result) {
2215
- if (reportErrors && nameNotFoundMessage) {
2214
+ if (nameNotFoundMessage) {
2216
2215
addLazyDiagnostic(() => {
2217
2216
if (!errorLocation ||
2218
2217
!checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg!) && // TODO: GH#18217
@@ -2265,12 +2264,12 @@ namespace ts {
2265
2264
}
2266
2265
return undefined;
2267
2266
}
2268
- else if (reportErrors && checkAndReportErrorForInvalidInitializer()) {
2267
+ else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
2269
2268
return undefined;
2270
2269
}
2271
2270
2272
2271
// Perform extra checks only if error reporting was requested
2273
- if (reportErrors && nameNotFoundMessage) {
2272
+ if (nameNotFoundMessage) {
2274
2273
addLazyDiagnostic(() => {
2275
2274
// Only check for block-scoped variable if we have an error location and are looking for the
2276
2275
// name with variable meaning
@@ -43502,8 +43501,7 @@ namespace ts {
43502
43501
/*nameArg*/ undefined,
43503
43502
/*isUse*/ true,
43504
43503
/*excludeGlobals*/ undefined,
43505
- /*getSpellingSuggestions*/ undefined,
43506
- /*reportErrors*/ false);
43504
+ /*getSpellingSuggestions*/ undefined);
43507
43505
}
43508
43506
43509
43507
function getReferencedValueDeclaration(referenceIn: Identifier): Declaration | undefined {
0 commit comments