本文整理汇总了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);
}
示例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 ();
}
}