internal void Populate() { if (IsInCoreAssembly) { BaseType = _bfCache.GetBfType(_typeDefinition.BaseType); if (BaseType != null && BaseType.FullName != "System.Object") { BaseType.DerivedTypes.Add(this); } _typeDefinition.Interfaces.Select(t => _bfCache.GetBfType(t)) .Where(t => t != null) .ForEach(t => { Interfaces.Add(t); t.DerivedTypes.Add(this); }); _typeDefinition.Fields.ForEach(f => Fields.Add(new BfField(_bfCache, f, this))); _typeDefinition.Methods.ForEach(m => { var bfMethod = new BfMethod(_bfCache, m, this); Methods.Add(bfMethod); Assembly.GetMethodsDictionary().Add(bfMethod.UniqueName, bfMethod); }); _typeDefinition.Events.ForEach(e => Events.Add(new BfEvent(_bfCache, e, this))); Interfaces.Clear(); Fields.Clear(); Methods.Clear(); Events.Clear(); } }
internal BfMethod(BfCache cache, MethodDefinition methodDef, BfType type) : base(cache, methodDef, type) { _methodDefinition = methodDef; _methodName = GetSignature(_methodDefinition); if (!type.IsInCoreAssembly) { return; } ReturnType = cache.GetBfType(methodDef.ReturnType); _typesUsed.AddRange(_cache.GetTypeCollection(methodDef.ReturnType)); _typesUsed.Add(ReturnType); _typesUsed.AddRange(_cache.GetTypeCollection(_methodDefinition)); if (methodDef.Body != null) { foreach (var variableDefinition in methodDef.Body.Variables) { _typesUsed.AddRange(_cache.GetTypeCollection(variableDefinition.VariableType)); _typesUsed.Add(_cache.GetBfType(variableDefinition.VariableType)); } } foreach (var parameterDefinition in methodDef.Parameters) { _typesUsed.AddRange(_cache.GetTypeCollection(parameterDefinition.ParameterType)); _typesUsed.Add(_cache.GetBfType(parameterDefinition.ParameterType)); ParameterTypes.AddRange(_cache.GetTypeCollection(parameterDefinition.ParameterType)); ParameterTypes.Add(_cache.GetBfType(parameterDefinition.ParameterType)); } ParameterTypes.Clear(); }