private void AddCompilationRootsForMultifileLibrary(EcmaModule module)
        {
            foreach (TypeDesc type in module.GetAllTypes())
            {
                // Skip delegates (since their Invoke methods have no IL) and uninstantiated generic types
                if (type.IsDelegate || type.ContainsGenericVariables)
                    continue;

                EcmaType ecmaType = type as EcmaType;

                if (ecmaType.Attributes.HasFlag(System.Reflection.TypeAttributes.Public))
                {
                    foreach (EcmaMethod method in ecmaType.GetMethods())
                    {
                        // Skip methods with no IL and uninstantiated generic methods
                        if (method.IsIntrinsic || method.IsAbstract || method.ContainsGenericVariables)
                            continue;

                        if (method.ImplAttributes.HasFlag(System.Reflection.MethodImplAttributes.InternalCall))
                            continue;

                        _rootProvider.AddCompilationRoot(method, "Library module method");
                    }
                }
            }
        }
        private void AddCompilationRootsForMultifileLibrary(EcmaModule module, IRootingServiceProvider rootProvider)
        {
            foreach (TypeDesc type in module.GetAllTypes())
            {
                // Skip delegates (since their Invoke methods have no IL) and uninstantiated generic types
                if (type.IsDelegate || type.ContainsGenericVariables)
                    continue;

                rootProvider.AddCompilationRoot(type, "Library module type");
                RootMethods(type, "Library module method", rootProvider);
            }
        }
 protected void AddCompilationRootsForRuntimeExports(EcmaModule module)
 {
     foreach (var type in module.GetAllTypes())
     {
         foreach (var method in type.GetMethods())
         {
             if (method.HasCustomAttribute("System.Runtime", "RuntimeExportAttribute"))
             {
                 string exportName = ((EcmaMethod)method).GetAttributeStringValue("System.Runtime", "RuntimeExportAttribute");
                 _rootProvider.AddCompilationRoot(method, "Runtime export", exportName);
             }
         }
     }
 }
        protected void AddCompilationRootsForExports(EcmaModule module)
        {
            foreach (var type in module.GetAllTypes())
            {
                foreach (var method in type.GetMethods())
                {
                    EcmaMethod ecmaMethod = (EcmaMethod)method;

                    if (ecmaMethod.IsRuntimeExport)
                    {
                        string runtimeExportName = ecmaMethod.GetRuntimeExportName();
                        if (runtimeExportName != null)
                            _rootProvider.AddCompilationRoot(method, "Runtime export", runtimeExportName);
                    }

                    if (ecmaMethod.IsNativeCallable)
                    {
                        string nativeCallableExportName = ecmaMethod.GetNativeCallableExportName();
                        if (nativeCallableExportName != null)
                            _rootProvider.AddCompilationRoot(method, "Native callable", nativeCallableExportName);
                    }
                }
            }
        }