Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement IEnumerator interface explicitly to satisfy dotnet linker #80

Merged
merged 1 commit into from
Nov 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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