private void ProcessModuleValueRegistration(string serviceName, IExpressionOrSpread expression) { // The type of the second argument - function, value, etc. var serviceType = expression.GetJsType(context, new JsCyclicFlowAccumulator()); var serviceOffset = context.GetDocumentStartOffset(expression); AssociateToServiceGlobalType(serviceName, serviceType, serviceOffset); }
private void AssociateToServiceGlobalType(string serviceName, string providerFunctionName, IExpressionOrSpread providerExpression) { var constructedFactoryType = providerExpression.GetJsType(context, new JsCyclicFlowAccumulator()). GetConstructedType(JsUnresolvedTypeArray.NoList); // The type of the service is the return type of the $get property, if it's a function. // If it's an array literal injectable, we need to add the association later, so create // a composite type that allows us to add it later var providerGetReturnType = constructedFactoryType.GetPropertyReferenceType("$get").GetReturnType(); var providerGetGlobalType = GetProviderGetGlobalType(providerFunctionName); var serviceType = JavaScriptType.CreateCompositeType(JsCombinedTypeKind.JsDynamic, providerGetReturnType, providerGetGlobalType); var offset = context.GetDocumentStartOffset(providerExpression); AssociateToServiceGlobalType(serviceName, serviceType, offset); }
private void ProcessModuleValueRegistration(string serviceName, IExpressionOrSpread expression) { // The type of the second argument - function, value, etc. var serviceType = expression.GetJsType(context); var serviceOffset = context.GetDocumentStartOffset(expression); AssociateToServiceGlobalType(serviceName, serviceType, serviceOffset); }
private void AssociateToServiceGlobalType(string serviceName, string providerFunctionName, IExpressionOrSpread providerExpression) { var constructedFactoryType = providerExpression.GetJsType(context). GetConstructedType(JsUnresolvedTypeArray.EmptyList); // The type of the service is the return type of the $get property, if it's a function. // If it's an array literal injectable, we need to add the association later, so create // a composite type that allows us to add it later var providerGetReturnType = constructedFactoryType.GetPropertyReferenceType("$get").GetReturnType(); var providerGetGlobalType = GetProviderGetGlobalType(providerFunctionName); var serviceType = JavaScriptType.CreateCompositeType(JsCombinedTypeKind.JsDynamic, providerGetReturnType, providerGetGlobalType); var offset = context.GetDocumentStartOffset(providerExpression); AssociateToServiceGlobalType(serviceName, serviceType, offset); }