public void Test03() { var func0 = ClrType.Get(GetType()).DeclaredMethods.Single(m => m.Name == nameof(Func0)).Require(); var f = func <int>(func0); claim.satisfies(f, g => g() == 32); }
public static Option <Choice <V> > Parse(string text) => from parseMethod in ClrType.Get <V>().ParseMethod from p in func <string, V>(parseMethod) let parts = text.Bifurcate(G.Entails) let identity = parts.Left.Bifurcate(G.OfType) from value in Try(() => p(parts.Right)) select new Choice <V>(identity, p(parts.Right));
public void Test04() { var func = ClrType.Get(GetType()).DeclaredMethods.Single(m => m.Name == nameof(Func1)).Require(); var call = func <int, string>(func).Require(); claim.equal("32", call(32)); }
public static ClrType[] types <X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12>() => array( ClrType.Get <X1>(), ClrType.Get <X2>(), ClrType.Get <X3>(), ClrType.Get <X4>(), ClrType.Get <X5>(), ClrType.Get <X6>(), ClrType.Get <X7>(), ClrType.Get <X8>(), ClrType.Get <X9>(), ClrType.Get <X10>(), ClrType.Get <X11>(), ClrType.Get <X12>() );
public void Test06() { var converters = ClrType.Get <ConversionOperatorImplementor>().DeclaredConversionOperators.ToList(); claim.equal(converters.Count, 3); var targets = converters.Targets <ConversionOperatorImplementor>().ToList(); claim.equal(targets.Count, 2); }
/// <summary> /// Gets the type adapter for <paramref name="t"/> /// </summary> /// <param name="t"></param> /// <returns></returns> public static ClrType type(Type t) => ClrType.Get(t);
static ClrType type <X>() => ClrType.Get <T>();
/// <summary> /// Defines an array <see cref="ClrTypeClosure"/> /// </summary> /// <param name="ArrayItemTypeName"></param> protected ClrTypeClosure(IClrTypeName ArrayItemTypeName) : base(ClrType.Get <Array>().TypeName) { TypeArguments = metacore.roitems(new TypeArgument(new TypeParameter(String.Empty, 0), ArrayItemTypeName)); IsArray = true; }
public void Test05() { var typeParams = ClrType.Get(GetType()).DeclaredMethods.Single(m => m.Name.StartsWith("IAmA")).Require().TypeParameters.ToList(); claim.count(2, typeParams); }
/// <summary> /// Searches for methods declared by a specified type that have a specific name /// </summary> /// <typeparam name="T">The type to search</typeparam> /// <param name="name">The name of the method</param> /// <returns></returns> public static Seq <ClrMethod> methods <T>(string name) => from m in ClrType.Get <T>().DeclaredMethods where m.Name == name select m;
/// <summary> /// Defines a <see cref="FieldSpec"/> /// </summary> /// <typeparam name="T">The field's type</typeparam> /// <param name="declaringType">The type that declares the field</param> /// <param name="name">The name of the field</param> /// <param name="init">The field initializer</param> /// <returns></returns> public static FieldSpec SpecifyField <T>(this ClrClassName declaringType, string name, ConstructorInvocationSpec init) => new FieldSpec(DeclaringTypeName: declaringType, Name: new ClrFieldName(name), FieldType: ClrType.Get <T>().GetReference(), AccessLevel: ClrAccessKind.Public, IsStatic: true, IsReadOnly: true, Initializer: new FieldInitializerSpec(init));
public static ClrType[] types <X1, X2, X3, X4, X5, X6, X7>() => array( ClrType.Get <X1>(), ClrType.Get <X2>(), ClrType.Get <X3>(), ClrType.Get <X4>(), ClrType.Get <X5>(), ClrType.Get <X6>(), ClrType.Get <X7>() );
public static ClrType[] types <X1, X2, X3, X4>() => array(ClrType.Get <X1>(), ClrType.Get <X2>(), ClrType.Get <X3>(), ClrType.Get <X4>());
public static ClrType type <T>() => ClrType.Get <T>();
public ClrType GetLiteralType() => ClrType.Get(ReflectedElement.GetEnumUnderlyingType());