/// <summary> /// Initializes a new instance of the <see cref="NativeClass"/> class. /// </summary> /// <param name="type">The <see cref="ITypeProxy"/> to analyze.</param> public NativeClass(ITypeProxy type) { if (type == null) { throw new ArgumentNullException(nameof(type)); } this.type = type; }
public static Type EnsureResolve(Type type) { while (true) { ITypeProxy typeProxy = type as ITypeProxy; if (typeProxy == null) { break; } type = typeProxy.GetResolvedType(); } return(type); }
public void AddTypeProxy <T>(ITypeProxy <T> typeProxy) { if (typeProxy == null) { throw new ArgumentNullException(nameof(typeProxy)); } if (_typeProxies.ContainsKey(typeof(T))) { throw new ArgumentException($"A proxy for type {typeof(T).FullName} already exists", nameof(typeProxy)); } _typeProxies.Add(typeof(T), typeProxy); _parameterTypeProxies.Add(typeProxy.GetType(), typeProxy); }
public static ITypeUniverse Universe(Type type) { ITypeProxy typeProxy = type as ITypeProxy; if (typeProxy != null) { return(typeProxy.TypeUniverse); } IAssembly2 assembly = type.Assembly as IAssembly2; if (assembly == null) { return(null); } return(assembly.TypeUniverse); }
private static void Test(string source, bool expected = true) { // Assembling some code IAssemblyLoader assemblyLoader = new Utils.AsmlDasmlAssemblyLoader(source); // Loading the assembly IAssemblyProxy assembly = assemblyLoader.Load(); // Locating the class ITypeInfoProxy classDefinition = assembly.LocateType("MyClass"); Assert.IsNotNull(classDefinition); ITypeProxy baseClass = classDefinition.BaseType; Assert.IsNotNull(baseClass); var helper = new ObjectClass(baseClass); Assert.AreEqual(expected, helper.Is, "Object class check failed"); }
/// <summary> /// Initializes a new instance of the <see cref="ObjectClass"/> class. /// </summary> /// <param name="type">The <see cref="ITypeProxy"/> to analyze.</param> public ObjectClass(ITypeProxy type) : base(type) { }
protected override string GetParameterTypeFullName(ITypeProxy type) => type.FullName.LookupTypeAndOverrideFullName(this.typeLookup);
protected virtual string GetParameterTypeFullName(ITypeProxy type) => type.FullName;
public TDerived WithTypeProxy(ITypeProxy <T> typeProxy) { _typeProxy = typeProxy ?? throw new ArgumentNullException(nameof(typeProxy)); return(this as TDerived); }
/// <summary> /// /// </summary> /// <param name="attribute"></param> /// <returns></returns> public static bool IsScriptNamespaceAttributeDecoration(ITypeProxy attribute) { return(attribute.Name == ScriptNamespaceFullName); }
protected virtual string GetInterfaceFullName(ITypeProxy type) => type.FullName;
protected virtual string GetBaseTypeFullName(ITypeProxy type) => type.FullName;
/// <summary> /// Initializes a new instance of the <see cref="ValueTypeClass"/> class. /// </summary> /// <param name="type">The <see cref="ITypeProxy"/> to analyze.</param> public ValueTypeClass(ITypeProxy type) : base(type) { }
protected virtual string GetReturnTypeFullName(ITypeProxy type) => type.FullName;
/// <summary> /// Initializes a new instance of the <see cref="EnumClass"/> class. /// </summary> /// <param name="type">The <see cref="ITypeProxy"/> to analyze.</param> public EnumClass(ITypeProxy type) : base(type) { }