private void ImportMethods(TypeSymbol typeSymbol) { // NOTE: We do not import parameters for imported members. // Parameters are used in the script model generation phase to populate // symbol tables, which is not done for imported methods. TypeDefinition type = (TypeDefinition)typeSymbol.MetadataReference; foreach (MethodDefinition method in type.Methods) { if (method.IsSpecialName) { continue; } if (method.IsPrivate || method.IsAssembly || method.IsFamilyAndAssembly) { continue; } string methodName = method.Name; if (typeSymbol.GetMember(methodName) != null) { // Ignore if its an overload since we don't care about parameters // for imported methods, overloaded ctors don't matter. // We just care about return values pretty much, and existence of the // method. continue; } TypeSymbol returnType = ResolveType(method.MethodReturnType.ReturnType); if (returnType == null) { continue; } // skip symbol generation for members decorated with [ScriptIgnore] if (MetadataHelpers.IsIgnored(method)) { continue; } MethodSymbol methodSymbol = new MethodSymbol( methodName, typeSymbol, returnType, MetadataHelpers.IsExtensionMethod(method)); if (MetadataHelpers.ShouldIgnoreMethodGeneratedTypeArguments(method)) { methodSymbol.IgnoreGeneratedTypeArguments = true; } methodSymbol.SetParseContext(method); ImportMemberDetails(methodSymbol, method, method); if (method.HasGenericParameters) { List <GenericParameterSymbol> genericArguments = new List <GenericParameterSymbol>(); foreach (GenericParameter genericParameter in method.GenericParameters) { GenericParameterSymbol arg = new GenericParameterSymbol(genericParameter.Position, genericParameter.Name, /* typeArgument */ false, symbols.GlobalNamespace); genericArguments.Add(arg); } methodSymbol.AddGenericArguments(genericArguments); } if (method.IsAbstract) { // NOTE: We're ignoring the override scenario - it doesn't matter in terms // of the compilation and code generation methodSymbol.SetImplementationState(SymbolImplementationFlags.Abstract); } if (MetadataHelpers.ShouldSkipFromScript(method)) { methodSymbol.SetSkipGeneration(); } string transformedName = MetadataHelpers.GetTransformedName(method); if (string.IsNullOrEmpty(transformedName) == false) { methodSymbol.SetTransformName(transformedName); } string scriptName = MetadataHelpers.GetScriptName(method, out _, out _); if (string.IsNullOrEmpty(scriptName) == false && !methodSymbol.IsTransformed) { methodSymbol.SetTransformedName(scriptName); } string selector = MetadataHelpers.GetScriptMethodSelector(method); if (string.IsNullOrEmpty(selector) == false) { methodSymbol.SetSelector(selector); } if (MetadataHelpers.ShouldTreatAsConditionalMethod(method, out ICollection <string> conditions)) { methodSymbol.SetConditions(conditions); } typeSymbol.AddMember(methodSymbol); } }