本文整理汇总了C#中IUnresolvedEntity类的典型用法代码示例。如果您正苦于以下问题:C# IUnresolvedEntity类的具体用法?C# IUnresolvedEntity怎么用?C# IUnresolvedEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUnresolvedEntity类属于命名空间,在下文中一共展示了IUnresolvedEntity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddMember
public void AddMember(IUnresolvedEntity entity, Mono.Cecil.MemberReference cecilObject)
{
rwLock.EnterWriteLock();
try {
uint token = cecilObject.MetadataToken.ToUInt32();
metadataTokens[entity] = token;
var cecilMethod = cecilObject as Mono.Cecil.MethodDefinition;
if (cecilMethod != null) {
IUnresolvedMethod method = (IUnresolvedMethod)entity;
tokenToMethod[token] = method;
if (cecilMethod.HasBody) {
var locals = cecilMethod.Body.Variables;
if (locals.Count > 0) {
localVariableTypes[method] = locals.Select(v => typeRefLoader.ReadTypeReference(v.VariableType)).ToArray();
}
if (cecilMethod.RVA != 0) {
// The method was loaded from image - we can free the memory for the body
// because Cecil will re-initialize it on demand
cecilMethod.Body = null;
}
}
}
} finally {
rwLock.ExitWriteLock();
}
}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:27,代码来源:TypeSystemExtensions.cs
示例2: EntityBookmark
public EntityBookmark(IUnresolvedEntity entity, IDocument document)
{
this.entity = entity;
int lineNr = entity.Region.BeginLine;
if (document != null && lineNr > 0 && lineNr < document.LineCount) {
this.line = document.GetLineByNumber(lineNr);
}
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:8,代码来源:EntityBookmark.cs
示例3: AbstractResolvedEntity
protected AbstractResolvedEntity(IUnresolvedEntity unresolved, ITypeResolveContext parentContext)
{
if (unresolved == null)
throw new ArgumentNullException("unresolved");
if (parentContext == null)
throw new ArgumentNullException("parentContext");
this.unresolved = unresolved;
this.parentContext = parentContext;
this.Attributes = unresolved.Attributes.CreateResolvedAttributes(parentContext);
}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:10,代码来源:AbstractResolvedEntity.cs
示例4: GetString
string GetString (Ambience amb, IUnresolvedEntity x)
{
var ctx = new SimpleTypeResolveContext (Document.Compilation.MainAssembly);
IEntity rx = null;
if (x is IUnresolvedMember)
rx = ((IUnresolvedMember)x).CreateResolved (ctx);
if (tag is IUnresolvedFile)
return amb.GetString (rx, OutputFlags.IncludeGenerics | OutputFlags.IncludeParameters | OutputFlags.UseFullInnerTypeName | OutputFlags.ReformatDelegates);
return amb.GetString (rx, OutputFlags.IncludeGenerics | OutputFlags.IncludeParameters | OutputFlags.ReformatDelegates);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:11,代码来源:DataProvider.cs
示例5: ForNonBodyRegion
/// <summary>
/// Creates a new QuickFix representing the non-bodyRegion
/// of the given region. Can be used to create QuickFixes
/// for AST members. The resulting QuickFix will then
/// contain the name and type signature of the member.
/// </summary>
/// <example>
/// For the region containing a "public string GetText(...)
/// {return null}" this method will return a QuickFix whose
/// Text is "public string GetText(...) ". So the returned
/// Text contains the type signature and not the body.
/// </example>
public static QuickFix ForNonBodyRegion(IUnresolvedEntity entity, IDocument document)
{
var text = GetNonBodyRegion
(entity.Region, document, entity.BodyRegion);
return new QuickFix
{ FileName = entity.Region.FileName
, Line = entity.Region.BeginLine
, Column = entity.Region.BeginColumn
, Text = text};
}
开发者ID:jchannon,项目名称:OmniSharpServer,代码行数:23,代码来源:QuickFix.cs
示例6: GetCecilObject
MemberReference GetCecilObject(IUnresolvedEntity entity)
{
object cecilObj;
if (unresolvedTypeSystemToCecilDict.TryGetValue(entity, out cecilObj)) {
return cecilObj as MemberReference;
} else {
return null;
}
}
开发者ID:ratoy,项目名称:SharpDevelop,代码行数:9,代码来源:AssemblyAnalyzer.cs
示例7: AddAttributes
void AddAttributes(PropertyInfo propertyDefinition, IUnresolvedEntity targetEntity)
{
AddCustomAttributes(propertyDefinition.CustomAttributes, targetEntity.Attributes);
}
开发者ID:jlyonsmith,项目名称:NRefactory,代码行数:4,代码来源:IkvmLoader.cs
示例8: GetFormattedReturnType
static string GetFormattedReturnType(IUnresolvedEntity entity)
{
string returnSignature = string.Empty;
var method = entity as AbstractUnresolvedMember;
if (method != null && method.ReturnType.ToString () != "void") {
returnSignature = string.Format (" : {0}", method.ReturnType);
}
return returnSignature;
}
开发者ID:prashantvc,项目名称:EditorComfortAddin,代码行数:11,代码来源:MemberListWindow.cs
示例9: GetCompletionImage
/// <summary>
/// Gets the CompletionImage instance for the specified entity.
/// Returns null when no image is available for the entity type.
/// </summary>
public static CompletionImage GetCompletionImage(IUnresolvedEntity entity)
{
if (entity == null)
throw new ArgumentNullException("entity");
switch (entity.SymbolKind) {
case SymbolKind.TypeDefinition:
return GetCompletionImageForType(((IUnresolvedTypeDefinition)entity).Kind, entity.IsStatic);
case SymbolKind.Field:
IUnresolvedField field = (IUnresolvedField)entity;
if (field.IsConst) {
if (field.DeclaringTypeDefinition != null && field.DeclaringTypeDefinition.Kind == TypeKind.Enum)
return imageEnumValue;
else
return imageLiteral;
}
return field.IsReadOnly ? imageFieldReadOnly : imageField;
case SymbolKind.Method:
IUnresolvedMethod method = (IUnresolvedMethod)entity;
return method.IsOverridable ? imageVirtualMethod : imageMethod;
case SymbolKind.Property:
return imageProperty;
case SymbolKind.Indexer:
return imageIndexer;
case SymbolKind.Event:
return imageEvent;
case SymbolKind.Operator:
case SymbolKind.Destructor:
return imageOperator;
case SymbolKind.Constructor:
return imageConstructor;
default:
return null;
}
}
开发者ID:AkshayVats,项目名称:SuperShell,代码行数:38,代码来源:CompletionImage.cs
示例10: SearchMember
ITreeNavigator SearchMember (IUnresolvedEntity member)
{
return SearchMember (GetIdString (member));
}
开发者ID:alexrp,项目名称:monodevelop,代码行数:4,代码来源:AssemblyBrowserWidget.cs
示例11: SearchMember
ITreeNavigator SearchMember (IUnresolvedEntity member, bool expandNode = true)
{
return SearchMember (GetIdString (member), expandNode);
}
开发者ID:kdubau,项目名称:monodevelop,代码行数:4,代码来源:AssemblyBrowserWidget.cs
示例12: GetGlobal
static string GetGlobal (IUnresolvedEntity entity)
{
switch (entity.SymbolKind) {
case SymbolKind.Field:
var field = (IUnresolvedField)entity;
return field.IsStatic && !field.IsConst ? "static-" : "";
case SymbolKind.Method:
case SymbolKind.Constructor:
case SymbolKind.Destructor:
case SymbolKind.Operator:
case SymbolKind.Property:
case SymbolKind.Indexer:
return entity.IsStatic ? "static-" : "";
}
return "";
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:16,代码来源:NRefactoryStock.cs
示例13: GetMetadataToken
public uint GetMetadataToken(IUnresolvedEntity entity)
{
rwLock.EnterReadLock();
try {
return metadataTokens[entity];
} finally {
rwLock.ExitReadLock();
}
}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:9,代码来源:TypeSystemExtensions.cs
示例14: NeedsDocumentation
static bool NeedsDocumentation (TextEditorData data, IUnresolvedEntity member)
{
int lineNr = member.Region.BeginLine - 1;
DocumentLine line;
do {
line = data.Document.GetLine (lineNr--);
} while (lineNr > 0 && data.Document.GetLineIndent (line).Length == line.Length);
return !data.Document.GetTextAt (line).TrimStart ().StartsWith ("///", StringComparison.Ordinal);
}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:9,代码来源:Commands.cs
示例15: GetCompletionImage
/// <summary>
/// Gets the CompletionImage instance for the specified entity.
/// Returns null when no image is available for the entity type.
/// </summary>
public static CompletionImage GetCompletionImage(IUnresolvedEntity entity)
{
if (entity == null)
throw new ArgumentNullException("entity");
switch (entity.SymbolKind) {
case SymbolKind.TypeDefinition:
return GetCompletionImageForType(((IUnresolvedTypeDefinition)entity).Kind, entity.IsStatic);
case SymbolKind.Field:
IUnresolvedField field = (IUnresolvedField)entity;
if (field.IsConst) {
if (field.DeclaringTypeDefinition != null && field.DeclaringTypeDefinition.Kind == TypeKind.Enum)
return imageEnumValue;
else
return imageLiteral;
}
return field.IsReadOnly ? imageFieldReadOnly : imageField;
case SymbolKind.Method:
IUnresolvedMethod method = (IUnresolvedMethod)entity;
// We cannot reliably detect extension methods in the unresolved type system (e.g. in VB we need to resolve an attribute),
// but at least we can do it for C#:
var defMethod = method as DefaultUnresolvedMethod;
if (defMethod != null && defMethod.IsExtensionMethod)
return imageExtensionMethod;
return method.IsOverridable ? imageVirtualMethod : imageMethod;
case SymbolKind.Property:
return imageProperty;
case SymbolKind.Indexer:
return imageIndexer;
case SymbolKind.Event:
return imageEvent;
case SymbolKind.Operator:
case SymbolKind.Destructor:
return imageOperator;
case SymbolKind.Constructor:
return imageConstructor;
default:
return null;
}
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:43,代码来源:CompletionImage.cs
示例16: GetAccess
static string GetAccess (IUnresolvedEntity entity)
{
switch (entity.Accessibility) {
case Accessibility.None:
return "";
case Accessibility.Private:
return "private-";
case Accessibility.Public:
return "";
case Accessibility.Protected:
return "protected-";
case Accessibility.Internal:
return "internal-";
case Accessibility.ProtectedOrInternal:
case Accessibility.ProtectedAndInternal:
return "ProtectedOrInternal-";
default:
throw new ArgumentOutOfRangeException ();
}
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:20,代码来源:NRefactoryStock.cs
示例17: GetParameters
static string GetParameters(IUnresolvedEntity entity)
{
var info = string.Empty;
var method = entity as DefaultUnresolvedMethod;
if (method != null) {
var typeInfo = method.Parameters.Select (p => p.Type.ToString ());
info = string.Format ("({0})", string.Join (", ", typeInfo));
}
return info;
}
开发者ID:prashantvc,项目名称:EditorComfortAddin,代码行数:11,代码来源:MemberListWindow.cs
示例18: GetSource
static string GetSource (IUnresolvedEntity entity)
{
switch (entity.SymbolKind) {
case SymbolKind.TypeDefinition:
var type = (IUnresolvedTypeDefinition)entity;
switch (type.Kind) {
case TypeKind.Class:
return "class";
case TypeKind.Interface:
return "interface";
case TypeKind.Struct:
return "struct";
case TypeKind.Delegate:
return "delegate";
case TypeKind.Enum:
return "enum";
}
return "class";
case SymbolKind.Field:
return "field";
case SymbolKind.Event:
return "event";
case SymbolKind.Method:
case SymbolKind.Constructor:
case SymbolKind.Destructor:
case SymbolKind.Operator:
return "method";
case SymbolKind.Property:
case SymbolKind.Indexer:
return "property";
}
return "";
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:33,代码来源:NRefactoryStock.cs
示例19: GetIcon
public static IImage GetIcon(IUnresolvedEntity entity)
{
return GetIImage(CompletionImage.GetImage(entity));
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:4,代码来源:ClassBrowserIconService.cs
示例20: IsInsideType
bool IsInsideType (IUnresolvedEntity currentType, TextLocation location)
{
var document = engine.document;
int startOffset = document.GetOffset (currentType.Region.Begin);
int endOffset = document.GetOffset (location);
bool foundEndBracket = false;
var bracketStack = new Stack<char> ();
bool isInString = false, isInChar = false;
bool isInLineComment = false, isInBlockComment = false;
for (int i = startOffset; i < endOffset; i++) {
char ch = document.GetCharAt (i);
switch (ch) {
case '(':
case '[':
case '{':
if (!isInString && !isInChar && !isInLineComment && !isInBlockComment)
bracketStack.Push (ch);
break;
case ')':
case ']':
case '}':
if (!isInString && !isInChar && !isInLineComment && !isInBlockComment)
if (bracketStack.Count > 0)
bracketStack.Pop ();
break;
case '\r':
case '\n':
isInLineComment = false;
break;
case '/':
if (isInBlockComment) {
if (i > 0 && document.GetCharAt (i - 1) == '*')
isInBlockComment = false;
} else if (!isInString && !isInChar && i + 1 < document.TextLength) {
char nextChar = document.GetCharAt (i + 1);
if (nextChar == '/')
isInLineComment = true;
if (!isInLineComment && nextChar == '*')
isInBlockComment = true;
}
break;
case '"':
if (!(isInChar || isInLineComment || isInBlockComment))
isInString = !isInString;
break;
case '\'':
if (!(isInString || isInLineComment || isInBlockComment))
isInChar = !isInChar;
break;
default :
break;
}
}
return bracketStack.Any (t => t == '{');
}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:59,代码来源:CppCompletionEngineBase.cs
注:本文中的IUnresolvedEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论