Skip to content

Commit 1b8933c

Browse files
committed
Renamed variables for clarity
1 parent 5e241a3 commit 1b8933c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/compiler/checker.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ module ts {
102102
let anyArrayType: Type;
103103
let globalTypedPropertyDescriptorType: ObjectType;
104104
let globalClassDecoratorType: ObjectType;
105-
let globalClassAnnotationType: ObjectType;
105+
let globalClassDecoratorErasedType: ObjectType;
106106
let globalParameterDecoratorType: ObjectType;
107-
let globalPropertyAnnotationType: ObjectType;
108107
let globalPropertyDecoratorType: ObjectType;
108+
let globalPropertyDecoratorErasedType: ObjectType;
109109

110110
let tupleTypes: Map<TupleType> = {};
111111
let unionTypes: Map<UnionType> = {};
@@ -8518,11 +8518,11 @@ module ts {
85188518
}
85198519
}
85208520

8521-
function checkDecoratorSignature(node: Decorator, exprType: Type, expectedAnnotationType: Type, parentType?: Type, expectedDecoratorType?: Type, message?: DiagnosticMessage) {
8521+
function checkDecoratorSignature(node: Decorator, exprType: Type, expectedErasedDecoratorType: Type, parentType?: Type, expectedGenericDecoratorType?: Type, message?: DiagnosticMessage) {
85228522
// first validate that we are using the correct decorator signature for the declaration
8523-
if (checkTypeAssignableTo(exprType, expectedAnnotationType, node) && expectedDecoratorType) {
8523+
if (checkTypeAssignableTo(exprType, expectedErasedDecoratorType, node) && parentType && expectedGenericDecoratorType && message) {
85248524
// next validate that we are not changing the static type in the decorator to a type that is not assignable.
8525-
checkTypeAssignableTo(exprType, instantiateSingleCallFunctionType(expectedDecoratorType, [parentType]), node, message);
8525+
checkTypeAssignableTo(exprType, instantiateSingleCallFunctionType(expectedGenericDecoratorType, [parentType]), node, message);
85268526
}
85278527
}
85288528

@@ -8535,15 +8535,15 @@ module ts {
85358535
case SyntaxKind.ClassDeclaration:
85368536
let classSymbol = getSymbolOfNode(node.parent);
85378537
let classType = getTypeOfSymbol(classSymbol);
8538-
checkDecoratorSignature(node, exprType, globalClassAnnotationType, classType, globalClassDecoratorType, Diagnostics.A_decorator_may_not_change_the_type_of_a_class);
8538+
checkDecoratorSignature(node, exprType, globalClassDecoratorErasedType, classType, globalClassDecoratorType, Diagnostics.A_decorator_may_not_change_the_type_of_a_class);
85398539
break;
85408540

85418541
case SyntaxKind.PropertyDeclaration:
85428542
case SyntaxKind.MethodDeclaration:
85438543
case SyntaxKind.GetAccessor:
85448544
case SyntaxKind.SetAccessor:
85458545
let propertyType = getTypeOfNode(node.parent);
8546-
checkDecoratorSignature(node, exprType, globalPropertyAnnotationType, propertyType, globalPropertyDecoratorType, Diagnostics.A_decorator_may_not_change_the_type_of_a_member);
8546+
checkDecoratorSignature(node, exprType, globalPropertyDecoratorErasedType, propertyType, globalPropertyDecoratorType, Diagnostics.A_decorator_may_not_change_the_type_of_a_member);
85478547
break;
85488548

85498549
case SyntaxKind.Parameter:
@@ -11374,9 +11374,9 @@ module ts {
1137411374
globalRegExpType = getGlobalType("RegExp");
1137511375
globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
1137611376
globalClassDecoratorType = getGlobalType("ClassDecorator");
11377-
globalClassAnnotationType = instantiateSingleCallFunctionType(globalClassDecoratorType, [globalFunctionType]);
11377+
globalClassDecoratorErasedType = instantiateSingleCallFunctionType(globalClassDecoratorType, [globalFunctionType]);
1137811378
globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
11379-
globalPropertyAnnotationType = instantiateSingleCallFunctionType(globalPropertyDecoratorType, [anyType]);
11379+
globalPropertyDecoratorErasedType = instantiateSingleCallFunctionType(globalPropertyDecoratorType, [anyType]);
1138011380
globalParameterDecoratorType = getGlobalType("ParameterDecorator");
1138111381

1138211382
// If we're in ES6 mode, load the TemplateStringsArray.

0 commit comments

Comments
 (0)