private static Dictionary<string, AType> ExtractFunctions(ScopeStorage scope)
{
Dictionary<string, AType> functions = new Dictionary<string, AType>();
if (scope == null)
{
return functions;
}
foreach (KeyValuePair<string, object> context in scope.GetItems())
{
ICollection<KeyValuePair<string, object>> contextItems =
context.Value as ICollection<KeyValuePair<string, object>>;
if (contextItems == null)
{
ScopeStorage test = context.Value as ScopeStorage;
if (test == null)
{
continue;
}
contextItems = test.GetItems();
}
foreach (KeyValuePair<string, object> variableInfo in contextItems)
{
AType variable = variableInfo.Value as AType;
if (variable != null && variable.Type == ATypes.AFunc && !variable.IsBox)
{
string[] parts = VariableHelper.CreateContextParts(context.Key, variableInfo.Key);
if (parts[0].Contains("."))
{
parts[0] = "";
}
string id = string.Join(".", parts);
functions.Add(id, variable);
}
}
}
return functions;
}