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


C# Misc.EnumRootPackagesSurroundingModule方法代码示例

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


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

示例1: LookupIdRawly

		public static AbstractType LookupIdRawly(Misc.ParseCacheView parseCache, ISyntaxRegion o, DModule oContext)
		{
			if (parseCache == null)
				throw new ArgumentNullException ("parseCache");
			if (o == null)
				throw new ArgumentNullException ("o");

			var ctxt = new ResolutionContext (parseCache, null, oContext, o.Location);

			/*
			 * Stuff like std.stdio.someSymbol should be covered by this already
			 */
			ctxt.ContextIndependentOptions = 
				ResolutionOptions.DontResolveBaseTypes | 
				ResolutionOptions.IgnoreAllProtectionAttributes | 
				ResolutionOptions.IgnoreDeclarationConditions | 
				ResolutionOptions.NoTemplateParameterDeduction | 
				ResolutionOptions.ReturnMethodReferencesOnly;

			AbstractType res;

			var td = o as ITypeDeclaration;
			var x = o as IExpression;

			if (td != null)
				res = TypeDeclarationResolver.ResolveSingle (td, ctxt, false);
			else if (x != null)
				res = ExpressionTypeEvaluation.EvaluateType (x, ctxt, false);
			else
				return null;

			if(res != null)
				return res;


			IntermediateIdType id;

			if (td != null)
				id = td.InnerMost as IntermediateIdType;
			else
				id = x as IntermediateIdType;

			if (id == null)
				return null;

			var l = new List<AbstractType> ();

			foreach (var pack in parseCache.EnumRootPackagesSurroundingModule(oContext)) {
				if (pack == null)
					continue;
				
				foreach (DModule mod in pack) {
					if (mod == null)
						continue;

					var children = mod [id.IdHash];
					if (children != null)
						foreach (var n in children)
							l.Add (TypeDeclarationResolver.HandleNodeMatch (n, ctxt, null, id));
				}
			}

			return AmbiguousType.Get(l);
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:64,代码来源:LooseResolution.cs

示例2: SearchNodesByName

		public static void SearchNodesByName(int idToFind, DModule parseCacheContext, Misc.ParseCacheView pcw, out List<ModulePackage> foundPackages, out List<INode> foundItems)
		{
			foundItems = new List<INode>();
			foundPackages = new List<ModulePackage>();

			if(idToFind == 0)
				return;

			var currentList = new List<IBlockNode>();
			var nextList = new List<IBlockNode>();

			var currentPackageList = new List<ModulePackage>();
			var nextPackageList = new List<ModulePackage>();

			currentPackageList.AddRange(pcw.EnumRootPackagesSurroundingModule(parseCacheContext));

			while(currentPackageList.Count != 0)
			{
				foreach(var pack in currentPackageList)
				{
					currentList.AddRange (pack.GetModules());

					if(pack.NameHash == idToFind)
						foundPackages.Add(pack);

					nextPackageList.AddRange(pack);
				}

				if(nextPackageList.Count == 0)
					break;

				currentPackageList.Clear();
				currentPackageList.AddRange(nextPackageList);
				nextPackageList.Clear();
			}


			while (currentList.Count != 0) {

				foreach (var i in currentList) {
					var items = i[idToFind];
					if (items != null)
						foundItems.AddRange (items);

					foreach (var k in i)
						if (k is IBlockNode && !foundItems.Contains (k))
							nextList.Add (k as IBlockNode);
				}

				currentList.Clear ();
				currentList.AddRange (nextList);
				nextList.Clear ();
			}
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:54,代码来源:LooseResolution.cs


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