Пример #1
0
        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (method.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute"))
            {
                RuntimeImportMethodNode runtimeImportMethod = new RuntimeImportMethodNode(method);

                // If the method is imported from either the current module or the runtime, reference it directly
                if (CompilationModuleGroup.ContainsMethodBody(method, false))
                {
                    return(runtimeImportMethod);
                }
                // If the method is imported from the runtime but not a managed assembly, reference it directly
                else if (!CompilationModuleGroup.ImportsMethod(method, false))
                {
                    return(runtimeImportMethod);
                }

                // If the method is imported from a managed assembly, reference it via an import cell
            }
            else
            {
                if (CompilationModuleGroup.ContainsMethodBody(method, false))
                {
                    return(NonExternMethodSymbol(method, false));
                }
            }

            return(_importedNodeProvider.ImportedMethodCodeNode(this, method, false));
        }