本文整理汇总了C#中System.Compiler.TypeNode.FindShadow方法的典型用法代码示例。如果您正苦于以下问题:C# TypeNode.FindShadow方法的具体用法?C# TypeNode.FindShadow怎么用?C# TypeNode.FindShadow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Compiler.TypeNode
的用法示例。
在下文中一共展示了TypeNode.FindShadow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SkipThisTypeDueToMismatchInReferenceAssemblyPlatform
private bool SkipThisTypeDueToMismatchInReferenceAssemblyPlatform(AssemblyNode ultimateTargetAssembly,
TypeNode typeNode)
{
if (ultimateTargetAssembly == null) return false;
if (typeNode == this.contractNodes.ContractClass)
return false; // don't skip contract methods as we need to extract their contracts
if (HelperMethods.IsCompilerGenerated(typeNode)) return false; // don't skip closures etc.
var typeWithSeparateContractClass = HelperMethods.IsContractTypeForSomeOtherTypeUnspecialized(typeNode, this.contractNodes);
if (typeWithSeparateContractClass != null)
{
typeNode = typeWithSeparateContractClass; // see if this one is skipped
}
// now see if we have corresponding target type
if (typeNode.FindShadow(ultimateTargetAssembly) != null) return false; // have target
return true; // skip it.
}
示例2: GetImplementation
/// <summary>
/// Returns the method implemented or overridden by the contractClass corresponding to the abstract method.
///
/// Can't use TypeNode.GetImplementingMethod because the Reader creates the names of explicit
/// interface methods such that it doesn't return them: it returns only implicit interface
/// implementations. A contract class should never have both implicit and explicit
/// implementations, so this just looks for an implicit first, then an explicit if that fails.
/// </summary>
/// <param name="contractClass">A class holding the contracts for an interface.</param>
/// <param name="interfaceMethod">A method from that interface.</param>
/// <returns>The method in the class that implements the interface method. </returns>
internal static Method GetImplementation(TypeNode contractClass, Method abstractMethod)
{
Method m = contractClass.FindShadow(abstractMethod);
if (m != null) // implicit implementation
return m;
if (abstractMethod.DeclaringType is Interface)
{
foreach (Member mem in contractClass.Members)
{
m = mem as Method;
if (m == null || m.ImplementedInterfaceMethods == null) continue;
foreach (Method ifaceMethod in m.ImplementedInterfaceMethods)
{
if (ifaceMethod == null) continue;
if (ifaceMethod == abstractMethod || ifaceMethod.Template == abstractMethod)
return m; // explicit implementation
if (ifaceMethod.Template != null && ifaceMethod.Template == abstractMethod.Template)
{
return m;
}
}
}
}
return null;
}
示例3: VisitTypeNode
public override void VisitTypeNode(TypeNode typeNode)
{
if (typeNode == null) return;
// we might have copied this type already
if (this.duplicatedMembers[typeNode.UniqueKey] != null)
{
return;
}
TypeNode targetType = typeNode.FindShadow(this.targetAssembly);
if (targetType != null)
{
if (targetType.Contract == null)
{
targetType.Contract = new TypeContract(targetType, true);
}
this.outOfBandDuplicator.TargetType = targetType;
if (typeNode.Contract != null)
{
InvariantList duplicatedInvariants =
this.outOfBandDuplicator.VisitInvariantList(typeNode.Contract.Invariants);
targetType.Contract.Invariants = duplicatedInvariants;
}
CopyAttributesWithoutDuplicateUnlessAllowMultiple(targetType, typeNode);
base.VisitTypeNode(typeNode);
}
else
{
// target type does not exist. Copy it
if (typeNode.DeclaringType != null)
{
// nested types are members and have been handled by CopyMissingMembers
}
else
{
this.outOfBandDuplicator.VisitTypeNode(typeNode);
}
}
}