You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.88
Former-commit-id: 4b7216ffda08448e562271ce733688e761120fc5
This commit is contained in:
parent
7d05485754
commit
6123a772ed
@@ -44,6 +44,7 @@ namespace Mono.Cecil.Rocks {
|
||||
|
||||
class ParseContext {
|
||||
public CodeReader Code { get; set; }
|
||||
public int Position { get; set; }
|
||||
public MetadataReader Metadata { get; set; }
|
||||
public Collection<VariableDefinition> Variables { get; set; }
|
||||
public IILVisitor Visitor { get; set; }
|
||||
@@ -58,6 +59,14 @@ namespace Mono.Cecil.Rocks {
|
||||
if (!method.HasBody || !method.HasImage)
|
||||
throw new ArgumentException ();
|
||||
|
||||
method.Module.Read (method, (m, _) => {
|
||||
ParseMethod (m, visitor);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
static void ParseMethod (MethodDefinition method, IILVisitor visitor)
|
||||
{
|
||||
var context = CreateContext (method, visitor);
|
||||
var code = context.Code;
|
||||
|
||||
@@ -75,15 +84,18 @@ namespace Mono.Cecil.Rocks {
|
||||
default:
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
code.MoveBackTo (context.Position);
|
||||
}
|
||||
|
||||
static ParseContext CreateContext (MethodDefinition method, IILVisitor visitor)
|
||||
{
|
||||
var code = method.Module.Read (method, (_, reader) => reader.code);
|
||||
code.MoveTo (method);
|
||||
var position = code.MoveTo (method);
|
||||
|
||||
return new ParseContext {
|
||||
Code = code,
|
||||
Position = position,
|
||||
Metadata = code.reader,
|
||||
Visitor = visitor,
|
||||
};
|
||||
|
@@ -189,10 +189,10 @@ namespace Mono.Cecil.Rocks {
|
||||
var instruction = self.Instructions [i];
|
||||
if (instruction.OpCode.Code != Code.Ldc_I8)
|
||||
continue;
|
||||
var l = (long)instruction.Operand;
|
||||
if (l >= uint.MaxValue)
|
||||
var l = (long) instruction.Operand;
|
||||
if (l >= int.MaxValue || l <= int.MinValue)
|
||||
continue;
|
||||
ExpandMacro (instruction, OpCodes.Ldc_I4, (uint)l);
|
||||
ExpandMacro (instruction, OpCodes.Ldc_I4, (int) l);
|
||||
self.Instructions.Insert (++i, Instruction.Create (OpCodes.Conv_I8));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user