/// <summary> /// Checks whether it can access a <see cref="TypeRef" /> /// </summary> /// <param name="tr">The type</param> /// <returns> /// <c>true</c> if it has access to it, <c>false</c> if not, and <c>null</c> /// if we can't determine it (eg. we couldn't resolve a type or input was <c>null</c>) /// </returns> public bool?CanAccess(TypeRef tr) { if (tr == null) { return(null); } return(CanAccess(tr.Resolve())); }
/// <summary> /// Gets a type color /// </summary> /// <param name="type">Type</param> /// <returns></returns> public virtual object GetColor(TypeRef type) { if (type == null) return BoxedTextColor.Text; var td = type.Resolve(); if (td != null) return GetColor(td); return BoxedTextColor.Type; }
ITypeDefOrRef TryResolve(TypeRef tr) { if (!IsThisModule(tr)) { return(tr); } var td = tr.Resolve(); if (td == null || td.Module != module) { return(tr); } return(td); }
private TypeDef Resolve(AssemblyRef asmRef, TypeRef typeRef) { var asm = ownerModule.Assembly; if (asm == null) { return(null); } if (asmRef.FullName != asm.GetFullNameWithPublicKey() && asmRef.FullName != asm.GetFullNameWithPublicKeyToken()) { return(null); } var td = typeRef.Resolve(); return(td != null && td.Module == ownerModule ? td : null); }
TypeDef Resolve(AssemblyRef asmRef, TypeRef typeRef) { var asm = ownerModule.Assembly; if (asm == null) { return(null); } if (!(AssemblyNameComparer.CompareAll.Equals(asmRef, asm) && asmRef.IsRetargetable == asm.IsRetargetable)) { return(null); } var td = typeRef.Resolve(); return(td != null && td.Module == ownerModule ? td : null); }
/// <summary> /// Checks whether it can access a <see cref="TypeRef"/> /// </summary> /// <param name="tr">The type</param> /// <returns><c>true</c> if it has access to it, <c>false</c> if not, and <c>null</c> /// if we can't determine it (eg. we couldn't resolve a type or input was <c>null</c>)</returns> public bool? CanAccess(TypeRef tr) { if (tr == null) return null; return CanAccess(tr.Resolve()); }
TypeDef Resolve(AssemblyRef asmRef, TypeRef typeRef) { var asm = ownerModule.Assembly; if (asm == null) return null; if (asmRef.FullName != asm.GetFullNameWithPublicKey() && asmRef.FullName != asm.GetFullNameWithPublicKeyToken()) return null; var td = typeRef.Resolve(); return td != null && td.Module == ownerModule ? td : null; }
public static TextTokenKind GetTextTokenType(TypeRef tr) { if (tr == null) return TextTokenKind.Text; var td = tr.Resolve(); if (td != null) return GetTextTokenType(td); return TextTokenKind.Type; }
void Find(TypeRef typeRef) { if (typeRef == null) return; // The type might've been moved, so always resolve it instead of using DefinitionAssembly var td = typeRef.Resolve(assembly.ModuleDefinition); if (td == null) Find(typeRef.DefinitionAssembly); else Find(td.DefinitionAssembly ?? typeRef.DefinitionAssembly); }