internal static Parameter WrapReturnParameter( MethodReturnType returnParameter, ClrAssembly assembly, IGenericMember enclosingMember) { var attrBuilder = new AttributeMapBuilder(); // TODO: actually analyze the parameter's attributes. return(new Parameter( TypeHelpers.BoxIfReferenceType( assembly.Resolve( returnParameter.ReturnType, enclosingMember)), returnParameter.Name, new AttributeMap(attrBuilder))); }
/// <summary> /// Wraps a CIL assembly definition in a Flame assembly, setting /// up an assembly resolver and type system. /// </summary> /// <param name="definition">The assembly definition to wrap.</param> /// <returns>A Flame assembly.</returns> public static ClrAssembly Wrap(AssemblyDefinition definition) { // Bootstrap a type system resolver. var typeSystem = new MutableTypeEnvironment(null); var resolver = new CecilAssemblyResolver( definition.MainModule.AssemblyResolver, typeSystem); var flameAsm = new ClrAssembly(definition, resolver.ReferenceResolver); var objectType = flameAsm.Resolve(definition.MainModule.TypeSystem.Object); var corlib = objectType.Parent.Assembly; typeSystem.InnerEnvironment = new CorlibTypeEnvironment(corlib); return(flameAsm); }
/// <summary> /// Wraps a CIL assembly definition in a Flame assembly, setting /// up an assembly resolver and type system. /// </summary> /// <param name="definition">The assembly definition to wrap.</param> /// <returns>A Flame assembly.</returns> public static ClrAssembly Wrap(AssemblyDefinition definition) { // Bootstrap a type system resolver. var typeSystem = new MutableTypeEnvironment(null); var resolver = new CecilAssemblyResolver( definition.MainModule.AssemblyResolver, typeSystem); var flameAsm = new ClrAssembly(definition, resolver.ReferenceResolver); // Register the assembly with its own resolver, so we don't get weirdness // where the assembly tries to resolve itself. resolver.ReferenceResolver.Register(definition.Name, flameAsm); var objectType = flameAsm.Resolve(definition.MainModule.TypeSystem.Object); var corlib = objectType.Parent.Assembly; typeSystem.InnerEnvironment = new CorlibTypeEnvironment(corlib); return(flameAsm); }