예제 #1
0
            private void AssociateToProviderGlobalType(string serviceName, string providerFunctionName,
                                                       IJavaScriptTypedExpression providerExpression)
            {
                var providerGlobalType = GetHiddenGlobalPropertyType(serviceName + ProviderSuffix);

                // The type of the injected provider is the constructed type of the provider factory
                // function. But the referenced expression might not be a factory function, but an
                // injectable array literal. Create a composite type that we can populate later, when
                // we see a provider-like function (e.g. a function ending in Provider)
                var constructedFactoryType = providerExpression.GetJsType(context, new JsCyclicFlowAccumulator()).
                                             GetConstructedType(JsUnresolvedTypeArray.NoList);
                var providerFunctionGlobalType = GetProviderFunctionGlobalType(providerFunctionName);
                var providerType = JavaScriptType.CreateCompositeType(JsCombinedTypeKind.JsDynamic,
                                                                      constructedFactoryType, providerFunctionGlobalType);

                // We can't provide a decent offset here. But do we need to?
                CreateAssignmentAssociation(providerGlobalType, providerType, -1);
            }
            private void AssociateToProviderGlobalType(string serviceName, string providerFunctionName,
                IJavaScriptTypedExpression providerExpression)
            {
                var providerGlobalType = GetHiddenGlobalPropertyType(serviceName + ProviderSuffix);

                // The type of the injected provider is the constructed type of the provider factory
                // function. But the referenced expression might not be a factory function, but an
                // injectable array literal. Create a composite type that we can populate later, when
                // we see a provider-like function (e.g. a function ending in Provider)
                var constructedFactoryType = providerExpression.GetJsType(context).
                    GetConstructedType(JsUnresolvedTypeArray.EmptyList);
                var providerFunctionGlobalType = GetProviderFunctionGlobalType(providerFunctionName);
                var providerType = JavaScriptType.CreateCompositeType(JsCombinedTypeKind.JsDynamic,
                    constructedFactoryType, providerFunctionGlobalType);

                // We can't provide a decent offset here. But do we need to?
                CreateAssignmentAssociation(providerGlobalType, providerType, -1);
            }