public int GetFunctionsCount(bool count_super, PowerObject.Access access) { int count = 0; PowerObject obj = this; while (obj != null) { foreach (ScriptFunction fun in obj.Functions) { if (fun.Access == access) { count++; } } if (count_super) { obj = obj.superClass; } else { obj = null; } if (obj != null) { count += obj.GetFunctionsCount(count_super, access); } } return(count); }