Skip to content

Commit 2d189dc

Browse files
committed
use symbol flag
1 parent 1472263 commit 2d189dc

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

Diff for: src/compiler/binder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ namespace ts {
538538
}
539539

540540
if (node.flags & NodeFlags.Deprecated) {
541-
symbol.isDeprecated = true;
541+
symbol.flags |= SymbolFlags.Deprecated;
542542
}
543543

544544
return symbol;

Diff for: src/compiler/checker.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -13146,7 +13146,7 @@ namespace ts {
1314613146
if (propName !== undefined) {
1314713147
const prop = getPropertyOfType(objectType, propName);
1314813148
if (prop) {
13149-
if (accessNode && prop.isDeprecated) {
13149+
if (accessNode && prop.flags & SymbolFlags.Deprecated) {
1315013150
const deprecatedNode = accessExpression?.argumentExpression ?? (isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
1315113151
errorOrSuggestion(/* isError */ false, deprecatedNode, Diagnostics._0_is_deprecated, propName as string);
1315213152
}
@@ -21681,7 +21681,7 @@ namespace ts {
2168121681
let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration;
2168221682

2168321683
const target = (symbol.flags & SymbolFlags.Alias ? resolveAlias(symbol) : symbol);
21684-
if (target.isDeprecated) {
21684+
if (target.flags & SymbolFlags.Deprecated) {
2168521685
errorOrSuggestion(/* isError */ false, node, Diagnostics._0_is_deprecated, node.escapedText as string);
2168621686
}
2168721687
if (localOrExportSymbol.flags & SymbolFlags.Class) {
@@ -24654,7 +24654,7 @@ namespace ts {
2465424654
propType = indexInfo.type;
2465524655
}
2465624656
else {
24657-
if (prop.isDeprecated) {
24657+
if (prop.flags & SymbolFlags.Deprecated) {
2465824658
errorOrSuggestion(/* isError */ false, right, Diagnostics._0_is_deprecated, right.escapedText as string);
2465924659
}
2466024660

@@ -30480,7 +30480,7 @@ namespace ts {
3048030480
}
3048130481
const symbol = getNodeLinks(node).resolvedSymbol;
3048230482
if (symbol) {
30483-
if (symbol.isDeprecated) {
30483+
if (symbol.flags & SymbolFlags.Deprecated) {
3048430484
const diagLocation = isTypeReferenceNode(node) && isQualifiedName(node.typeName) ? node.typeName.right : node;
3048530485
errorOrSuggestion(/* isError */ false, diagLocation, Diagnostics._0_is_deprecated, symbol.escapedName as string);
3048630486
}
@@ -34821,7 +34821,7 @@ namespace ts {
3482134821
}
3482234822
}
3482334823

34824-
if (isImportSpecifier(node) && target.isDeprecated) {
34824+
if (isImportSpecifier(node) && target.flags & SymbolFlags.Deprecated) {
3482534825
errorOrSuggestion(/* isError */ false, node.name, Diagnostics._0_is_deprecated, symbol.escapedName as string);
3482634826
}
3482734827
}

Diff for: src/compiler/types.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -4508,10 +4508,10 @@ namespace ts {
45084508
Transient = 1 << 25, // Transient symbol (created during type check)
45094509
Assignment = 1 << 26, // Assignment treated as declaration (eg `this.prop = 1`)
45104510
ModuleExports = 1 << 27, // Symbol for CommonJS `module` of `module.exports`
4511-
4511+
Deprecated = 1 << 28, // Symbol has Deprecated declaration tag (eg `@deprecated`)
45124512
/* @internal */
45134513
All = FunctionScopedVariable | BlockScopedVariable | Property | EnumMember | Function | Class | Interface | ConstEnum | RegularEnum | ValueModule | NamespaceModule | TypeLiteral
4514-
| ObjectLiteral | Method | Constructor | GetAccessor | SetAccessor | Signature | TypeParameter | TypeAlias | ExportValue | Alias | Prototype | ExportStar | Optional | Transient,
4514+
| ObjectLiteral | Method | Constructor | GetAccessor | SetAccessor | Signature | TypeParameter | TypeAlias | ExportValue | Alias | Prototype | ExportStar | Optional | Transient | Deprecated,
45154515

45164516
Enum = RegularEnum | ConstEnum,
45174517
Variable = FunctionScopedVariable | BlockScopedVariable,
@@ -4588,7 +4588,6 @@ namespace ts {
45884588
/* @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol?
45894589
/* @internal */ isAssigned?: boolean; // True if the symbol is a parameter with assignments
45904590
/* @internal */ assignmentDeclarationMembers?: Map<Declaration>; // detected late-bound assignment declarations associated with the symbol
4591-
/* @internal */ isDeprecated?: boolean
45924591
}
45934592

45944593
/* @internal */

Diff for: tests/baselines/reference/api/tsserverlibrary.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2313,6 +2313,7 @@ declare namespace ts {
23132313
Transient = 33554432,
23142314
Assignment = 67108864,
23152315
ModuleExports = 134217728,
2316+
Deprecated = 268435456,
23162317
Enum = 384,
23172318
Variable = 3,
23182319
Value = 111551,

Diff for: tests/baselines/reference/api/typescript.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2313,6 +2313,7 @@ declare namespace ts {
23132313
Transient = 33554432,
23142314
Assignment = 67108864,
23152315
ModuleExports = 134217728,
2316+
Deprecated = 268435456,
23162317
Enum = 384,
23172318
Variable = 3,
23182319
Value = 111551,

0 commit comments

Comments
 (0)