当前位置: 首页>>代码示例>>C#>>正文


C# ExpressionVisitor.CheckForBaseAccess方法代码示例

本文整理汇总了C#中CodeCompletion.ExpressionVisitor.CheckForBaseAccess方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionVisitor.CheckForBaseAccess方法的具体用法?C# ExpressionVisitor.CheckForBaseAccess怎么用?C# ExpressionVisitor.CheckForBaseAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CodeCompletion.ExpressionVisitor的用法示例。


在下文中一共展示了ExpressionVisitor.CheckForBaseAccess方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetNamesAsInObject

 public override SymInfo[] GetNamesAsInObject(ExpressionVisitor ev)
 {
     List<SymInfo> syms = new List<SymInfo>();
     if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
         return syms.ToArray();
     MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
     List<MemberInfo> members = new List<MemberInfo>();
     members.AddRange(mis);
     IEnumerable<MemberInfo> en = PascalABCCompiler.NetHelper.NetHelper.GetExtensionMethods(ctn);
     members.AddRange(en);
     mis = members.ToArray();
     if (ctn.IsInterface)
     {
         List<MemberInfo> mems = new List<MemberInfo>();
         mems.AddRange(mis);
         mems.AddRange(typeof(object).GetMembers(BindingFlags.Public | BindingFlags.Instance));
         Type[] types = ctn.GetInterfaces();
         foreach (Type t in types)
             mems.AddRange(t.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy));
         mis = mems.ToArray();
     }
     foreach (MemberInfo mi in mis)
         if (!mi.Name.Contains("$"))
             switch (mi.MemberType)
             {
                 case MemberTypes.Method: if (!(mi as MethodInfo).IsSpecialName)
                     {
                         SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
                         si2 = new CompiledMethodScope(si2, mi as MethodInfo, this).si;
                         if (si2.acc_mod == access_modifer.protected_modifer)
                         {
                             if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                 syms.Add(si2);
                         }
                         else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
                             syms.Add(si2);
                     }
                     break;
                 case MemberTypes.Field:
                     {
                         if (!(mi as FieldInfo).IsSpecialName)
                         {
                             SymInfo si2 = new SymInfo(null, SymbolKind.Field, null);
                             if ((mi as FieldInfo).IsLiteral) si2.kind = SymbolKind.Constant;
                             si2 = new CompiledFieldScope(si2, mi as FieldInfo, this).si;
                             if (si2.acc_mod == access_modifer.protected_modifer)
                             {
                                 if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                     syms.Add(si2);
                             }
                             else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
                                 syms.Add(si2);
                         }
                     }
                     break;
                 case MemberTypes.Property:
                     {
                         SymInfo si2 = new SymInfo(null, SymbolKind.Property, null);
                         si2 = new CompiledPropertyScope(si2, mi as PropertyInfo, this).si;
                         if (si2.acc_mod == access_modifer.protected_modifer)
                         {
                             if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                 syms.Add(si2);
                         }
                         else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
                             syms.Add(si2);
                     }
                     break;
                 case MemberTypes.Event:
                     {
                         SymInfo si2 = new SymInfo(null, SymbolKind.Event, null);
                         si2 = new CompiledEventScope(si2, mi as EventInfo, this).si;
                         if (si2.acc_mod == access_modifer.protected_modifer)
                         {
                             if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                 syms.Add(si2);
                         }
                         else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
                             syms.Add(si2);
                     }
                     break;
             }
     if (implemented_interfaces != null && false)
     {
         foreach (TypeScope ts in implemented_interfaces)
             syms.AddRange(ts.GetNamesAsInObject(ev));
     }
     return syms.ToArray();
 }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:89,代码来源:SymTable.cs

示例2: GetNames

 public override SymInfo[] GetNames(ExpressionVisitor ev, PascalABCCompiler.Parsers.KeywordKind keyword, bool called_in_base)
 {
     List<SymInfo> syms = new List<SymInfo>();
     if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
         return syms.ToArray();
     MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.NonPublic |/*BindingFlags.Instance|*/BindingFlags.Static | BindingFlags.FlattenHierarchy);
     List<MemberInfo> constrs = new List<MemberInfo>();
     //constrs.AddRange(ctn.GetNestedTypes(BindingFlags.Public));
     //if (ctn != typeof(object))
     ConstructorInfo[] cis = ctn.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
     foreach (ConstructorInfo ci in cis)
         if (!called_in_base)
             constrs.Add(ci);
         else if (ci.GetParameters().Length > 0)
             constrs.Add(ci);
     constrs.AddRange(mis);
     //constrs.AddRange(PascalABCCompiler.NetHelper.NetHelper.GetExtensionMethods(ctn));
     mis = constrs.ToArray();
     if (ctn.IsInterface)
     {
         return syms.ToArray();
     }
     foreach (MemberInfo mi in mis)
         if (!mi.Name.Contains("$"))
             switch (mi.MemberType)
             {
                 case MemberTypes.Method: if (!(mi as MethodInfo).IsSpecialName && (mi as MethodInfo).IsStatic)
                     {
                         SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
                         CompiledMethodScope member = new CompiledMethodScope(si2, mi as MethodInfo, this);
                         si2 = member.si;
                         if (si2.acc_mod == access_modifer.protected_modifer)
                         {
                             if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                 syms.Add(si2);
                         }
                         else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
                             syms.Add(si2);
                     }
                     break;
                 case MemberTypes.Field:
                     {
                         if (!(mi as FieldInfo).IsSpecialName && (mi as FieldInfo).IsStatic)
                         {
                             SymInfo si2 = new SymInfo(null, SymbolKind.Field, null);
                             if ((mi as FieldInfo).IsLiteral) si2.kind = SymbolKind.Constant;
                             si2 = new CompiledFieldScope(si2, mi as FieldInfo, this).si;
                             if (si2.acc_mod == access_modifer.protected_modifer)
                             {
                                 if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                     syms.Add(si2);
                             }
                             else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
                                 syms.Add(si2);
                         }
                     }
                     break;
                 case MemberTypes.Constructor:
                     {
                         SymInfo si2 = new SymInfo(null, SymbolKind.Method, null);
                         CompiledConstructorScope member = new CompiledConstructorScope(si2, mi as ConstructorInfo, this);
                         si2 = member.si;
                         if (si2.acc_mod == access_modifer.protected_modifer)
                         {
                             if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                 syms.Add(si2);
                         }
                         else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
                             syms.Add(si2);
                     }
                     break;
                 case MemberTypes.Property:
                     {
                         PropertyInfo pi = mi as PropertyInfo;
                         if (pi.GetGetMethod(true) != null && pi.GetGetMethod(true).IsStatic)
                         {
                             SymInfo si2 = new SymInfo(null, SymbolKind.Property, null);
                             si2 = new CompiledPropertyScope(si2, mi as PropertyInfo, this).si;
                             if (si2.acc_mod == access_modifer.protected_modifer)
                             {
                                 if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                     syms.Add(si2);
                             }
                             else if (si2.acc_mod != access_modifer.private_modifer && si2.acc_mod != access_modifer.internal_modifer)
                                 syms.Add(si2);
                         }
                     }
                     break;
                 case MemberTypes.Event:
                     {
                         MethodInfo acc_mi = (mi as EventInfo).GetAddMethod(true);
                         if (acc_mi != null && acc_mi.IsStatic)
                         {
                             SymInfo si2 = new SymInfo(null, SymbolKind.Event, null);
                             si2 = new CompiledEventScope(si2, mi as EventInfo, this).si;
                             syms.Add(si2);
                             if (si2.acc_mod == access_modifer.protected_modifer)
                             {
                                 if (ev.CheckForBaseAccess(ev.entry_scope, this))
                                     syms.Add(si2);
//.........这里部分代码省略.........
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:101,代码来源:SymTable.cs

示例3: GetNamesInAllTopScopes

        //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();
        }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:37,代码来源:SymTable.cs

示例4: GetNameOfMethod

 /// <summary>
 /// Получить подсказку параметров метода
 /// </summary>
 public string[] GetNameOfMethod(expression expr, string str, int line, int col, int num_param,ref int defIndex, int choose_param_num, out int param_count)
 {
 	param_count = 0;
 	if (stv.cur_scope == null) return null;
 	if (col +1 > str.Length)
 		col -= str.Length;
 	SymScope si = stv.FindScopeByLocation(line+1,col+1);//stv.cur_scope;
 	if (si == null) 
 	{
 		si = stv.FindScopeByLocation(line,col+1);
 		if (si == null)
 		return null;
 	}
     SetCurrentUsedAssemblies();
 	ExpressionVisitor ev = new ExpressionVisitor(expr, si, stv);
 	List<ProcScope> scopes = ev.GetOverloadScopes();
 	bool was_empty_params = false;
     if (scopes.Count == 0)
     {
         RestoreCurrentUsedAssemblies();
         return null;
     }
 	si = scopes[0];
 	//if (si is ElementScope && (si as ElementScope).sc is ProcScope) si = (si as ElementScope).sc as ProcScope;
 	//if (si is ElementScope && (si as ElementScope).sc is ProcType) si = ((si as ElementScope).sc as ProcType).target;
 	if (si != null && si is ProcScope)
 	{
 		List<string> procs = new List<string>();
 		List<ProcScope> proc_defs = new List<ProcScope>();
 		ProcScope ps = si as ProcScope;
 		int i = 0; bool stop = false;
 		ProcScope tmp = ps;
 		while (i < scopes.Count)
 		{
 			if (i == defIndex) 
 			{
 				if (tmp.GetParametersCount() != 0)
 				{
 					choose_param_num = tmp.GetParametersCount();
 					param_count = choose_param_num;
 				}
 				break;
 			}
 			i++;
 			tmp = scopes[i];
 		}
 		i = 0;
 		while (ps != null)
 		{
 			//if (!ps.si.name.StartsWith("$"))
 			//if (!stop && ((ps.GetParametersCount() >= num_param) || ps.GetParametersCount() == 0 && num_param == 1 && choose_param_num==1))
 			//if (i == defIndex) param_count = ps.GetParametersCount();
 			if (!stop && num_param > choose_param_num && ps.GetParametersCount() >= num_param && ps.GetParametersCount() > choose_param_num)
 			{
 				//if (ps.GetParametersCount() >= choose_param_num && choose_param_num == 1 || choose_param_num > 1 && ps.GetParametersCount() > choose_param_num)
 				{
 					defIndex = i;
 					stop = true;
 					param_count = ps.GetParametersCount();
 				}
 				//System.Diagnostics.Debug.WriteLine(defIndex);
 			}
 			if (ps is CompiledMethodScope)
 				ps.AddDocumentation(AssemblyDocCache.GetDocumentation((ps as CompiledMethodScope).mi));
 			else if (ps is CompiledConstructorScope)
 				ps.AddDocumentation(AssemblyDocCache.GetDocumentation((ps as CompiledConstructorScope).mi));
 			else if (ps is ProcScope)
 			{
 				if (!ps.si.has_doc)
 				{
 					ps.AddDocumentation(UnitDocCache.GetDocumentation(ps as ProcScope));
 				}
 			}
 			if (ps.acc_mod == access_modifer.protected_modifer || ps.acc_mod == access_modifer.private_modifer)
 			{
 				if (ps.acc_mod == access_modifer.private_modifer)
 				{
 					if (ev.IsInOneModule(ev.entry_scope,ps.topScope))
 						if (!ps.si.not_include && !equal_params(ps,proc_defs))
 						{
 							procs.Add(ps.si.description);
 							proc_defs.Add(ps);
 						}
 				}
 				else
 				if (ev.CheckForBaseAccess(ev.entry_scope,ps.topScope))
 					if (!ps.si.not_include && !equal_params(ps,proc_defs))
 					{
 						procs.Add(ps.si.description);
 						proc_defs.Add(ps);
 					}
 			}
 			else 
 			if (!ps.si.not_include)
 			/*if (ps.GetParametersCount() == 0)
 			{
 				if (!was_empty_params)
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:DomConverter.cs


注:本文中的CodeCompletion.ExpressionVisitor.CheckForBaseAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。