本文整理汇总了C#中IType.AcceptVisitor方法的典型用法代码示例。如果您正苦于以下问题:C# IType.AcceptVisitor方法的具体用法?C# IType.AcceptVisitor怎么用?C# IType.AcceptVisitor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IType
的用法示例。
在下文中一共展示了IType.AcceptVisitor方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compile
public static MethodBuilder Compile(IType functorType, string variableName,
TypeBuilder utilityClass, string[] genericParameters, IRuntimeContainer runtimeContainer)
{
var genericParameterNames = new[]
{
Constants.FMapMethodInputParameterName,
Constants.FMapMethodOutputParameterName
}.Concat(genericParameters).ToArray();
var fmap = utilityClass.DefineMethod(Constants.FMapMethodName, MethodAttributes.Public | MethodAttributes.Static);
var fmapParameters = fmap.DefineGenericParameters(genericParameterNames);
fmap.SetReturnType(typeof(IFunction<,>).MakeGenericType(fmapParameters.Take(2).Select(t => FunctorTypeMapper.Map(functorType, variableName, t, fmapParameters, runtimeContainer)).ToArray()));
fmap.SetParameters(typeof(IFunction<,>).MakeGenericType(fmapParameters.Take(2).ToArray()));
var fmapBody = fmap.GetILGenerator();
functorType.AcceptVisitor(new FmapCompiler(fmapBody, variableName, fmapParameters, runtimeContainer));
fmapBody.Emit(OpCodes.Ret);
return fmap;
}
示例2: GetTypeParameterOwner
/// <summary>
/// Gets the entity that owns the type parameters occurring in the specified type.
/// If both class and method type parameters are present, the method is returned.
/// Returns null if the specified type is closed.
/// </summary>
/// <seealso cref="IsOpen"/>
static IEntity GetTypeParameterOwner(IType type)
{
if (type == null)
throw new ArgumentNullException("type");
TypeClassificationVisitor v = new TypeClassificationVisitor();
type.AcceptVisitor(v);
return v.typeParameterOwner;
}
示例3: AddRelationshipsForType
void AddRelationshipsForType(NodeBase node, IType type)
{
type.AcceptVisitor(new AnalysisTypeVisitor(this, node));
}
示例4: SubstituteInType
/// <summary>
/// Substitutes the class type parameters in the <paramref name="type"/> with the
/// type arguments of this parameterized type.
/// </summary>
public IType SubstituteInType(IType type)
{
return type.AcceptVisitor(new TypeParameterSubstitution(typeArguments, null));
}
示例5: Substitute
internal static IType Substitute(IType type, TypeVisitor substitution)
{
if (substitution == null)
return type;
else
return type.AcceptVisitor(substitution);
}
示例6: NormalizeMethodTypeParameters
/// <summary>
/// Replaces all occurrences of method type parameters in the given type
/// by normalized type parameters. This allows comparing parameter types from different
/// generic methods.
/// </summary>
public static IType NormalizeMethodTypeParameters(IType type)
{
return type.AcceptVisitor(normalizeMethodTypeParameters);
}
示例7: VisitOtherType
public override IType VisitOtherType(IType type)
{
return NullableType.Create(compilation, type.AcceptVisitor(typeParameterSubstitution));
}
示例8: SubstituteInType
/// <summary>
/// Substitutes the class type parameters in the <paramref name="type"/> with the
/// type arguments of this parameterized type.
/// </summary>
public IType SubstituteInType(IType type)
{
return type.AcceptVisitor(new Substitution(typeArguments));
}
示例9: IdentityConversion
/// <summary>
/// Gets whether there is an identity conversion from <paramref name="fromType"/> to <paramref name="toType"/>
/// </summary>
public bool IdentityConversion(IType fromType, IType toType)
{
// C# 4.0 spec: §6.1.1
return fromType.AcceptVisitor(dynamicErasure).Equals(toType.AcceptVisitor(dynamicErasure));
}