mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 14:55:34 +00:00
Changed uses of IEnumerable to List in order to prevent multiple enumerations.
This commit is contained in:
parent
da71abb963
commit
a29f72663c
|
@ -45,7 +45,7 @@ namespace OpenTK.Rewrite
|
||||||
var file = args[0];
|
var file = args[0];
|
||||||
var key = args[1];
|
var key = args[1];
|
||||||
var options = args.Where(a => a.StartsWith("-") || a.StartsWith("/"));
|
var options = args.Where(a => a.StartsWith("-") || a.StartsWith("/"));
|
||||||
program.Rewrite(file, key, options);
|
program.Rewrite(file, key, options.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// mscorlib types
|
// mscorlib types
|
||||||
|
@ -61,7 +61,7 @@ namespace OpenTK.Rewrite
|
||||||
|
|
||||||
static bool dllimport;
|
static bool dllimport;
|
||||||
|
|
||||||
void Rewrite(string file, string keyfile, IEnumerable<string> options)
|
void Rewrite(string file, string keyfile, List<string> options)
|
||||||
{
|
{
|
||||||
dllimport = options.Contains("-dllimport");
|
dllimport = options.Contains("-dllimport");
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ namespace OpenTK.Rewrite
|
||||||
{
|
{
|
||||||
provider = new Mono.Cecil.Mdb.MdbReaderProvider();
|
provider = new Mono.Cecil.Mdb.MdbReaderProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
read_params.SymbolReaderProvider = provider;
|
read_params.SymbolReaderProvider = provider;
|
||||||
read_params.ReadSymbols = true;
|
read_params.ReadSymbols = true;
|
||||||
read_params.ReadWrite = true;
|
read_params.ReadWrite = true;
|
||||||
|
@ -154,7 +155,7 @@ namespace OpenTK.Rewrite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rewrite(TypeDefinition type, IEnumerable<string> options)
|
void Rewrite(TypeDefinition type, List<string> options)
|
||||||
{
|
{
|
||||||
var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints");
|
var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints");
|
||||||
if (entry_points != null)
|
if (entry_points != null)
|
||||||
|
@ -196,7 +197,7 @@ namespace OpenTK.Rewrite
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rewrite(TypeDefinition type, FieldDefinition entry_points,
|
void Rewrite(TypeDefinition type, FieldDefinition entry_points,
|
||||||
List<MethodDefinition> entry_signatures, IEnumerable<string> options)
|
List<MethodDefinition> entry_signatures, List<string> options)
|
||||||
{
|
{
|
||||||
// Rewrite all wrapper methods
|
// Rewrite all wrapper methods
|
||||||
var wrapper_signatures = new List<MethodDefinition>();
|
var wrapper_signatures = new List<MethodDefinition>();
|
||||||
|
@ -206,8 +207,8 @@ namespace OpenTK.Rewrite
|
||||||
foreach (var wrapper in wrapper_signatures)
|
foreach (var wrapper in wrapper_signatures)
|
||||||
{
|
{
|
||||||
var autogenerated = wrapper.CustomAttributes
|
var autogenerated = wrapper.CustomAttributes
|
||||||
.Where(a => a.AttributeType.Name == "AutoGeneratedAttribute");
|
.Where(a => a.AttributeType.Name == "AutoGeneratedAttribute").ToList();
|
||||||
if (autogenerated.Count() > 0)
|
if (autogenerated.Any())
|
||||||
{
|
{
|
||||||
var signature_name = (string)autogenerated.First()
|
var signature_name = (string)autogenerated.First()
|
||||||
.Fields.First(f => f.Name == "EntryPoint").Argument.Value;
|
.Fields.First(f => f.Name == "EntryPoint").Argument.Value;
|
||||||
|
@ -258,7 +259,7 @@ namespace OpenTK.Rewrite
|
||||||
|
|
||||||
// Create body for method
|
// Create body for method
|
||||||
static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot,
|
static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot,
|
||||||
FieldDefinition entry_points, IEnumerable<string> options)
|
FieldDefinition entry_points, List<string> options)
|
||||||
{
|
{
|
||||||
var body = wrapper.Body;
|
var body = wrapper.Body;
|
||||||
var il = body.GetILProcessor();
|
var il = body.GetILProcessor();
|
||||||
|
|
Loading…
Reference in a new issue