@@ -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> = {};
@@ -8808,24 +8807,24 @@ module ts {
88088807 case SyntaxKind.ClassDeclaration:
88098808 let classSymbol = getSymbolOfNode(node.parent);
88108809 let classConstructorType = getTypeOfSymbol(classSymbol);
8811- let classDecoratorType = instantiateSingleCallFunctionType(globalClassDecoratorType , [classConstructorType]);
8810+ let classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType() , [classConstructorType]);
88128811 checkTypeAssignableTo(exprType, classDecoratorType, node);
88138812 break;
88148813
88158814 case SyntaxKind.PropertyDeclaration:
8816- checkTypeAssignableTo(exprType, globalPropertyDecoratorType , node);
8815+ checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType() , node);
88178816 break;
88188817
88198818 case SyntaxKind.MethodDeclaration:
88208819 case SyntaxKind.GetAccessor:
88218820 case SyntaxKind.SetAccessor:
88228821 let methodType = getTypeOfNode(node.parent);
8823- let methodDecoratorType = instantiateSingleCallFunctionType(globalMethodDecoratorType , [methodType]);
8822+ let methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType() , [methodType]);
88248823 checkTypeAssignableTo(exprType, methodDecoratorType, node);
88258824 break;
88268825
88278826 case SyntaxKind.Parameter:
8828- checkTypeAssignableTo(exprType, globalParameterDecoratorType , node);
8827+ checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType() , node);
88298828 break;
88308829 }
88318830 }
@@ -11987,11 +11986,10 @@ module ts {
1198711986 globalNumberType = getGlobalType("Number");
1198811987 globalBooleanType = getGlobalType("Boolean");
1198911988 globalRegExpType = getGlobalType("RegExp");
11990- globalTypedPropertyDescriptorType = getTypeOfGlobalSymbol(getGlobalTypeSymbol("TypedPropertyDescriptor"), 1);
11991- globalClassDecoratorType = getGlobalType("ClassDecorator");
11992- globalPropertyDecoratorType = getGlobalType("PropertyDecorator");
11993- globalMethodDecoratorType = getGlobalType("MethodDecorator");
11994- globalParameterDecoratorType = getGlobalType("ParameterDecorator");
11989+ getGlobalClassDecoratorType = memoize(() => getGlobalType("ClassDecorator"));
11990+ getGlobalPropertyDecoratorType = memoize(() => getGlobalType("PropertyDecorator"));
11991+ getGlobalMethodDecoratorType = memoize(() => getGlobalType("MethodDecorator"));
11992+ getGlobalParameterDecoratorType = memoize(() => getGlobalType("ParameterDecorator"));
1199511993
1199611994 // If we're in ES6 mode, load the TemplateStringsArray.
1199711995 // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
0 commit comments