diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-01-30 00:28:05 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-01-30 00:28:05 +0100 |
| commit | c29275576f75534c9fd109b3d3717ab52ec8415b (patch) | |
| tree | 2bb12851411af33988a43ea9a35bfe4ee34eba83 /src/IML/Context.cs | |
| parent | e3c509d4a9a27f663a3a95ab697bfdb2e880172d (diff) | |
- test with both parameterless ctor and with iface param ctorInCodeInstatiation
- CurrentInterface as field
Diffstat (limited to 'src/IML/Context.cs')
| -rw-r--r-- | src/IML/Context.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/IML/Context.cs b/src/IML/Context.cs index fb103580..7c34745d 100644 --- a/src/IML/Context.cs +++ b/src/IML/Context.cs @@ -68,8 +68,13 @@ namespace Crow.IML il.DeclareLocal (typeof (GraphicObject)); il.Emit (OpCodes.Nop); - //set local GraphicObject to root object - il.Emit (OpCodes.Newobj, rootType.GetConstructors () [0]); + //set local GraphicObject to root object + ConstructorInfo ci = rootType.GetConstructor ( + BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, + null, Type.EmptyTypes, null); + if (ci == null) + throw new Exception ("No default parameterless constructor found in " + rootType.Name); + il.Emit (OpCodes.Newobj, ci); il.Emit (OpCodes.Stloc_0); CompilerServices.emitSetCurInterface (il); } |