本文整理汇总了C#中IUnresolvedEntity类的典型用法代码示例。如果您正苦于以下问题:C# IUnresolvedEntity类的具体用法?C# IUnresolvedEntity怎么用?C# IUnresolvedEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUnresolvedEntity类属于命名空间,在下文中一共展示了IUnresolvedEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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};
}
示例6: GetCecilObject
MemberReference GetCecilObject(IUnresolvedEntity entity)
{
object cecilObj;
if (unresolvedTypeSystemToCecilDict.TryGetValue(entity, out cecilObj)) {
return cecilObj as MemberReference;
} else {
return null;
}
}
示例7: AddAttributes
void AddAttributes(PropertyInfo propertyDefinition, IUnresolvedEntity targetEntity)
{
AddCustomAttributes(propertyDefinition.CustomAttributes, targetEntity.Attributes);
}
示例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;
}
示例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;
}
}
示例10: SearchMember
ITreeNavigator SearchMember (IUnresolvedEntity member)
{
return SearchMember (GetIdString (member));
}
示例11: SearchMember
ITreeNavigator SearchMember (IUnresolvedEntity member, bool expandNode = true)
{
return SearchMember (GetIdString (member), expandNode);
}
示例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 "";
}
示例13: GetMetadataToken
public uint GetMetadataToken(IUnresolvedEntity entity)
{
rwLock.EnterReadLock();
try {
return metadataTokens[entity];
} finally {
rwLock.ExitReadLock();
}
}
示例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);
}
示例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;
}
}