Commit d7f1849b authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Fixed #116 problem accessing base class method

+ regression test.
parent f70558bd
......@@ -684,6 +684,14 @@ namespace NLua
LuaLib.LuaPushNil (luaState);
}
} else {
if (objType.UnderlyingSystemType != typeof(object)) {
#if NETFX_CORE
return GetMember (luaState, new ProxyType(objType.UnderlyingSystemType.GetTypeInfo().BaseType), obj, methodName, bindingType);
#else
return GetMember (luaState, new ProxyType(objType.UnderlyingSystemType.BaseType), obj, methodName, bindingType);
#endif
}
// kevinh - we want to throw an exception because meerly returning 'nil' in this case
// is not sufficient. valid data members may return nil and therefore there must be some
// way to know the member just doesn't exist.
......
......@@ -21,6 +21,29 @@ using NUnit.Framework;
namespace NLuaTest
{
#if MONOTOUCH
[Preserve (AllMembers = true)]
#endif
public class master
{
public static string read()
{
return "test-master";
}
}
#if MONOTOUCH
[Preserve (AllMembers = true)]
#endif
public class testClass : master
{
public String strData;
public int intData;
public static string read2()
{
return "test";
}
}
#if MONOTOUCH
[Preserve (AllMembers = true)]
......@@ -34,6 +57,8 @@ namespace NLuaTest
}
}
#if MONOTOUCH
[Preserve (AllMembers = true)]
#endif
......@@ -2202,6 +2227,18 @@ namespace NLuaTest
Assert.True (!string.IsNullOrEmpty(x));
}
[Test]
public void TestCallImplicitBaseMethod ()
{
using (var l = new Lua ()) {
l.LoadCLRPackage ();
l.DoString ("import ('NLuaTest')");
l.DoString ("res = testClass.read() ");
string res = (string)l ["res"];
Assert.AreEqual (testClass.read (), res);
}
}
static Lua m_lua;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment