本文整理汇总了C#中MonoDevelop.Projects.Dom.Parser.ProjectDom.SearchType方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectDom.SearchType方法的具体用法?C# ProjectDom.SearchType怎么用?C# ProjectDom.SearchType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Projects.Dom.Parser.ProjectDom
的用法示例。
在下文中一共展示了ProjectDom.SearchType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResult
public GenerateNamespaceImport GetResult (ProjectDom dom, ICompilationUnit unit, IType type, TextEditorData data)
{
GenerateNamespaceImport result;
if (cache.TryGetValue (type.Namespace, out result))
return result;
result = new GenerateNamespaceImport ();
cache[type.Namespace] = result;
result.InsertNamespace = false;
DomLocation location = new DomLocation (data.Caret.Line, data.Caret.Column);
foreach (IUsing u in unit.Usings.Where (u => u.ValidRegion.Contains (location))) {
if (u.Namespaces.Any (ns => type.Namespace == ns)) {
result.GenerateUsing = false;
return result;
}
}
result.GenerateUsing = true;
string name = type.DecoratedFullName.Substring (type.Namespace.Length + 1);
foreach (IUsing u in unit.Usings.Where (u => u.ValidRegion.Contains (location))) {
foreach (string ns in u.Namespaces) {
if (dom.SearchType (unit, unit.GetTypeAt (location), unit.GetMemberAt (location), ns + "." + name) != null) {
result.GenerateUsing = false;
result.InsertNamespace = true;
return result;
}
}
}
return result;
}
示例2: InstantiatedParameterType
public InstantiatedParameterType (ProjectDom dom, ITypeParameterMember typeParameterMember, ITypeParameter tp)
{
IType outerType = typeParameterMember as IType ?? typeParameterMember.DeclaringType;
typeparam = tp;
compilationUnit = outerType.CompilationUnit;
ClassType = ClassType.Class;
Modifiers = Modifiers.Public;
Name = tp.Name;
Namespace = outerType.DecoratedFullName;
Location = outerType.Location;
DeclaringType = outerType;
if (tp.Constraints.Count > 0)
ClassType = ClassType.Interface;
foreach (IReturnType rt in tp.Constraints) {
if (FindCyclicReference (new HashSet<ITypeParameter> () { tp }, outerType, ((DomReturnType)rt).DecoratedFullName))
continue;
IType bt = dom.SearchType (typeParameterMember, rt);
IReturnType resolvedType = rt;
if (bt != null) {
resolvedType = new DomReturnType (bt);
if (bt.ClassType == ClassType.Interface || BaseType != null) {
AddInterfaceImplementation (resolvedType);
} else {
ClassType = bt.ClassType;
BaseType = resolvedType;
}
} else {
AddInterfaceImplementation (resolvedType);
}
}
if (BaseType == null)
BaseType = DomReturnType.Object;
}
示例3: CreateResolveResult
public override IEnumerable<object> CreateResolveResult (ProjectDom dom, IMember callingMember)
{
List<object> result = new List<object> ();
if (CallingMember != null && !CallingMember.IsStatic) {
IType baseType = dom.SearchType (CallingType != null ? CallingType.CompilationUnit : null, CallingType, CallingMember.Location ,CallingType.BaseType ?? DomReturnType.Object);
MemberResolveResult.AddType (dom, result, baseType, new BaseMemberDecorator (CallingMember, baseType), StaticResolve, m => m.IsAbstract);
}
return result;
}
示例4: ExpressionResult
//.........这里部分代码省略.........
if (ch == '\n' || ch == '\r')
break;
if (wasWhitespace && IsNamePart(ch)) {
start++;
if (start < chunk.Offset)
start = Int32.MaxValue;
break;
}
if (ch == '<') {
bracketCount--;
if (bracketCount < 0) {
start++;
break;
}
start--;
wasWhitespace = false;
continue;
}
if (ch == '>') {
if (wasWhitespace && !wasDot)
break;
bracketCount++;
start--;
wasWhitespace = false;
continue;
}
if (!IsNamePart(ch) && !Char.IsWhiteSpace (ch) && ch != '.') {
start++;
break;
}
wasWhitespace = Char.IsWhiteSpace (ch);
wasDot = ch == '.' || wasDot && wasWhitespace;
start--;
}
int end = i;
int genericCount = 0;
wasWhitespace = false;
List<Segment> nameSegments = new List<Segment> ();
while (end < chunk.EndOffset) {
char ch = doc.GetCharAt (end);
if (wasWhitespace && IsNamePart(ch))
break;
if (ch == '<') {
genericCount = 1;
while (end < doc.Length) {
ch = doc.GetCharAt (end);
if (ch == ',')
genericCount++;
if (ch == '>') {
nameSegments.Add (new Segment (end, 1));
break;
}
end++;
}
break;
}
if (!IsNamePart(ch) && !Char.IsWhiteSpace (ch))
break;
wasWhitespace = Char.IsWhiteSpace (ch);
end++;
}
if (start >= end)
continue;
string typeString = doc.GetTextBetween (start, end);
IReturnType returnType = NRefactoryResolver.ParseReturnType (new ExpressionResult (typeString));
int nameEndOffset = start;
for (; nameEndOffset < end; nameEndOffset++) {
char ch = doc.GetCharAt (nameEndOffset);
if (nameEndOffset >= i && ch == '<') {
nameEndOffset++;
break;
}
}
nameSegments.Add (new Segment (i, nameEndOffset - i));
int column = i - line.Offset;
IType callingType = unit.GetTypeAt (lineNumber, column);
List<IReturnType> genericParams = null;
if (genericCount > 0) {
genericParams = new List<IReturnType> ();
for (int n = 0; n < genericCount; n++)
genericParams.Add (new DomReturnType ("A"));
}
IType type = null;
if (ctx != null)
type = ctx.SearchType ((MonoDevelop.Projects.Dom.INode)callingType ?? unit, returnType);
if (type == null && unit != null && returnType != null)
type = unit.GetType (returnType.FullName, returnType.GenericArguments.Count);
if (ctx != null && type == null && returnType != null) {
returnType.Name += "Attribute";
type = ctx.SearchType ((MonoDevelop.Projects.Dom.INode)callingType ?? unit, returnType);
}
if (type != null)
nameSegments.ForEach (segment => HighlightSegment (startChunk, segment, "keyword.semantic.type"));
}
}
}