Exemplo n.º 1
0
        //poluchit imena s klassa s kluchevym slovom
        //vyzyvaetsja, kogda procedure TClass. tut vse ekzemplarnye i staticheskie
        public virtual SymInfo[] GetNames(ExpressionVisitor ev, PascalABCCompiler.Parsers.KeywordKind keyword, bool called_in_base)
        {
            List<SymInfo> lst = new List<SymInfo>();
            foreach (SymScope ss in members)
            {
                if (!ss.si.name.StartsWith("$"))
                {
                    if (keyword != PascalABCCompiler.Parsers.KeywordKind.Function && keyword != PascalABCCompiler.Parsers.KeywordKind.Constructor && keyword != PascalABCCompiler.Parsers.KeywordKind.Destructor/*!(ev.entry_scope is InterfaceUnitScope) && !(ev.entry_scope is ImplementationUnitScope)*/)
                    {
                        if (ss.si.acc_mod == access_modifer.private_modifer)
                        {
                            if (ss.is_static && ev.CheckPrivateForBaseAccess(ev.entry_scope, this))
                                lst.Add(ss.si);
                        }
                        else if (ss.si.acc_mod == access_modifer.protected_modifer)
                        {
                            if (ss.is_static && ev.CheckForBaseAccess(ev.entry_scope, this))
                                lst.Add(ss.si);
                        }
                        else
                            if (ss.is_static)
                                lst.Add(ss.si);
                            else if ((ss is ProcScope) && (ss as ProcScope).IsConstructor())
                                if (!((ss as ProcScope).parameters == null || (ss as ProcScope).parameters.Count == 0) || !called_in_base)
                                    lst.Add(ss.si);
                    }
                    else
                    {
                        if (ss is ProcScope && !(ss as ProcScope).already_defined)
                        {
                            if (keyword == PascalABCCompiler.Parsers.KeywordKind.Function || keyword == PascalABCCompiler.Parsers.KeywordKind.Destructor)
                                lst.Add(ss.si);
                            else if ((ss as ProcScope).IsConstructor())
                                lst.Add(ss.si);
                        }
                    }
                    if (!ss.si.has_doc)
                        UnitDocCache.AddDescribeToComplete(ss);
                }
            }

            if (baseScope != null && keyword != PascalABCCompiler.Parsers.KeywordKind.Constructor && keyword != PascalABCCompiler.Parsers.KeywordKind.Destructor)
                lst.AddRange(baseScope.GetNames(ev, keyword, true));
            /*if (topScope != null)
                lst.AddRange(topScope.GetNames());*/
            return lst.ToArray();
        }
Exemplo n.º 2
0
 //poluchit vse imena kak po tochke iz objektnoj peremennoj, sootv. ekzemplarnye chleny klassa i nadklassov
 public override SymInfo[] GetNamesAsInObject(ExpressionVisitor ev)
 {
     //if (original_type != null)
     //	return original_type.GetNamesAsInObject(ev);
     List<SymInfo> lst = new List<SymInfo>();
     foreach (SymScope ss in members)
     {
         if (ss is ProcScope && (ss as ProcScope).IsConstructor()) continue;
         if (!ss.si.name.StartsWith("$") && !ss.is_static && !(ss is TemplateParameterScope))
         {
             if (ss.si.acc_mod == access_modifer.private_modifer)
             {
                 if (ev.CheckPrivateForBaseAccess(ev.entry_scope, this))
                     lst.Add(ss.si);
             }
             else if (ss.si.acc_mod == access_modifer.protected_modifer)
             {
                 if (ev.CheckForBaseAccess(ev.entry_scope, this))
                     lst.Add(ss.si);
             }
             else
                 lst.Add(ss.si);
             if (!ss.si.has_doc)
                 UnitDocCache.AddDescribeToComplete(ss);
         }
     }
     if (this.documentation != null && this.documentation.Contains("!#") && baseScope is CompiledScope)
         return lst.ToArray();
     if (baseScope != null)
     {
         lst.AddRange(baseScope.GetNamesAsInObject(ev));
     }
     if (implemented_interfaces != null && !(this is ArrayScope && (this as ArrayScope).IsMultiDynArray))
         foreach (TypeScope ts in implemented_interfaces)
             lst.AddRange(ts.GetNamesAsInObject(ev));
     return lst.ToArray();
 }
Exemplo n.º 3
0
        //esli naprimer nazhali ctrl-probel(all_name = treu) ili shift-probel (all_names = false)
        //visitor vsegda nuzhen tak kak hranit scope, gde my nazhali
        public override SymInfo[] GetNamesInAllTopScopes(bool all_names, ExpressionVisitor ev, bool is_static)
        {
            List<SymInfo> lst = new List<SymInfo>();
            foreach (SymScope ss in members)
            {
                if (ss is ProcScope && (ss as ProcScope).IsConstructor())
                    continue;
                if (!ss.si.name.StartsWith("$"))
                {
                    if (ss.si.acc_mod == access_modifer.private_modifer)
                    {
                        if (ev.CheckPrivateForBaseAccess(ev.entry_scope, this))
                            if (!is_static) lst.Add(ss.si);
                            else if (ss.is_static) lst.Add(ss.si);
                    }
                    else if (ss.si.acc_mod == access_modifer.protected_modifer)
                    {
                        if (ev.CheckForBaseAccess(ev.entry_scope, this))
                            if (!is_static) lst.Add(ss.si);
                            else if (ss.is_static) lst.Add(ss.si);
                    }
                    else
                        if (!is_static) lst.Add(ss.si);
                        else if (ss.is_static) lst.Add(ss.si);
                    if (!ss.si.has_doc)
                        UnitDocCache.AddDescribeToComplete(ss);
                }
            }
            if (baseScope != null)
                lst.AddRange(baseScope.GetNamesAsInBaseClass(ev, is_static));
            if (topScope != null)
                lst.AddRange(topScope.GetNamesInAllTopScopes(all_names, ev, is_static));

            return lst.ToArray();
        }