internal void AddPredefinedMethodToSymbolTable(AggregateSymbol type, Name methodName)
{
Type t = type.getThisType().AssociatedSystemType;
// If we got here, it means we couldn't find it in our initial lookup. Means we haven't loaded it from reflection yet.
// Lets go and do that now.
// Check if we have constructors or not.
if (methodName == _nameManager.GetPredefinedName(PredefinedName.PN_CTOR))
{
var ctors = Enumerable.Where(t.GetConstructors(), m => m.Name == methodName.Text);
foreach (ConstructorInfo c in ctors)
{
AddMethodToSymbolTable(
c,
type,
MethodKindEnum.Constructor);
}
}
else
{
var methods = Enumerable.Where(t.GetRuntimeMethods(), m => m.Name == methodName.Text && m.DeclaringType == t);
foreach (MethodInfo m in methods)
{
AddMethodToSymbolTable(
m,
type,
m.Name == SpecialNames.Invoke ? MethodKindEnum.Invoke : MethodKindEnum.Actual);
}
}
}