Skip to content

Commit

Permalink
Fixed #314
Browse files Browse the repository at this point in the history
  • Loading branch information
liiir1985 committed Apr 1, 2020
1 parent 5a30a15 commit 000ba1c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ILRuntime/Runtime/Intepreter/ILIntepreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3119,13 +3119,10 @@ public object Run(ILMethod method, object instance, object[] p)
default:
throw new NotImplementedException();
}

Free(esp - 1);
esp--;
}
else
{
PushNull(esp);
//PushNull(esp);
switch (objRef->ObjectType)
{
case ObjectTypes.StaticFieldReference:
Expand Down Expand Up @@ -3161,9 +3158,10 @@ public object Run(ILMethod method, object instance, object[] p)
}
else if(type.IsPrimitive)
StackObject.Initialized(objRef, type);
Free(esp - 1);
esp--;
}

Free(esp - 1);
esp--;
}
break;
case OpCodeEnum.Isinst:
Expand Down
24 changes: 24 additions & 0 deletions TestCases/InheritanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,30 @@ public static void InheritanceTest12()
}
}

public static void InheritanceTest13()
{
new TestClass().TestMethod();
}

public interface IData { }

public class Data : IData { }

public abstract class Test<T> where T : class, IData
{
public T Data { get; protected set; }

public void TestMethod()
{
Data = null;//此处赋值为null会出现异常, 非null不会发生异常
Console.WriteLine(Data);
}
}

public class TestClass : Test<Data>
{
}

class TestCls5 : TestClass2
{
public override float AbMethod2(int arg1)
Expand Down

0 comments on commit 000ba1c

Please sign in to comment.