Skip to content

Commit

Permalink
Merge pull request #80 from maxkatz6/master
Browse files Browse the repository at this point in the history
Implement IEnumerator interface explicitly to satisfy dotnet linker
  • Loading branch information
kekekeks authored Nov 26, 2022
2 parents cd3682c + abce42a commit 491de98
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/XamlX/IL/RuntimeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,16 @@ void MethodStub(string name)
.Emit(OpCodes.Ldfld, current)
.Emit(OpCodes.Ret);

enumeratorBuilder.DefineMethod(typeSystem.FindType("System.Void"), new IXamlType[0], "Reset", true, false,
true).Generator
enumeratorBuilder.DefineMethod(typeSystem.FindType("System.Void"), new IXamlType[0],
enumeratorObjectType.FullName+".Reset", false, false,
true, enumeratorObjectType.FindMethod(m => m.Name == "Reset")).Generator
.Emit(OpCodes.Newobj,
typeSystem.FindType("System.NotSupportedException").FindConstructor(new List<IXamlType>()))
.Emit(OpCodes.Throw);

var disposeGen = enumeratorBuilder.DefineMethod(typeSystem.FindType("System.Void"), new IXamlType[0],
"Dispose", true, false, true ).Generator;
"System.IDisposable.Dispose", false, false, true,
typeSystem.GetType("System.IDisposable").FindMethod(m => m.Name == "Dispose")).Generator;
var disposeRet = disposeGen.DefineLabel();
disposeGen
.Emit(OpCodes.Ldarg_0)
Expand All @@ -579,8 +581,9 @@ void MethodStub(string name)

var boolType = typeSystem.GetType("System.Boolean");
var moveNext = enumeratorBuilder.DefineMethod(boolType, new IXamlType[0],
"MoveNext", true,
false, true).Generator;
enumeratorObjectType.FullName+".MoveNext", false,
false, true,
enumeratorObjectType.FindMethod(m => m.Name == "MoveNext")).Generator;


const int stateInit = 0;
Expand Down

0 comments on commit 491de98

Please sign in to comment.