@@ -114,11 +114,10 @@ module ts {
114114 let globalIterableType: ObjectType;
115115
116116 let anyArrayType: Type;
117- let globalTypedPropertyDescriptorType: ObjectType;
118- let globalClassDecoratorType: ObjectType;
119- let globalParameterDecoratorType: ObjectType;
120- let globalPropertyDecoratorType: ObjectType;
121- let globalMethodDecoratorType: ObjectType;
117+ let getGlobalClassDecoratorType: () => ObjectType;
118+ let getGlobalParameterDecoratorType: () => ObjectType;
119+ let getGlobalPropertyDecoratorType: () => ObjectType;
120+ let getGlobalMethodDecoratorType: () => ObjectType;
122121
123122 let tupleTypes: Map<TupleType> = {};
124123 let unionTypes: Map<UnionType> = {};
@@ -8790,24 +8789,24 @@ module ts {
87908789 case SyntaxKind.ClassDeclaration:
87918790 let classSymbol = getSymbolOfNode(node.parent);
87928791 let classConstructorType = getTypeOfSymbol(classSymbol);
8793- let classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType , [classConstructorType]);
8792+ let classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType() , [classConstructorType]);
87948793 checkTypeAssignableTo(exprType, classDecoratorType, node);
87958794 break;
87968795
87978796 case SyntaxKind.PropertyDeclaration:
8798- checkTypeAssignableTo(exprType, globalPropertyDecoratorType , node);
8797+ checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType() , node);
87998798 break;
88008799
88018800 case SyntaxKind.MethodDeclaration:
88028801 case SyntaxKind.GetAccessor:
88038802 case SyntaxKind.SetAccessor:
88048803 let methodType = getTypeOfNode(node.parent);
8805- let methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType , [methodType]);
8804+ let methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType() , [methodType]);
88068805 checkTypeAssignableTo(exprType, methodDecoratorType, node);
88078806 break;
88088807
88098808 case SyntaxKind.Parameter:
8810- checkTypeAssignableTo(exprType, globalParameterDecoratorType , node);
8809+ checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType() , node);
88118810 break;
88128811 }
88138812 }
@@ -11969,11 +11968,10 @@ module ts {
1196911968 globalNumberType = getGlobalType("Number");
1197011969 globalBooleanType = getGlobalType("Boolean");
1197111970 globalRegExpType = getGlobalType("RegExp");
11972- globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
11973- globalClassDecoratorType = getGlobalType("ClassDecorator");
11974- globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
11975- globalMethodDecoratorType = getGlobalType("MethodDecorator");
11976- globalParameterDecoratorType = getGlobalType("ParameterDecorator");
11971+ getGlobalClassDecoratorType = memoize(() => getGlobalType("ClassDecorator"));
11972+ getGlobalPropertyDecoratorType = memoize(() => getGlobalType("PropertyDecorator"));
11973+ getGlobalMethodDecoratorType = memoize(() => getGlobalType("MethodDecorator"));
11974+ getGlobalParameterDecoratorType = memoize(() => getGlobalType("ParameterDecorator"));
1197711975
1197811976 // If we're in ES6 mode, load the TemplateStringsArray.
1197911977 // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
0 commit comments