} // func MemberGetSandbox private static Expression MemberGetExpressionCore(Lua lua, Token tokenStart, Expression instance, string memberName) { // if this is a dynamic type, let the type deside what is to do if (LuaEmit.IsDynamicType(instance.Type)) { return(DynamicExpression.Dynamic(lua.GetGetMemberBinder(memberName), typeof(object), ConvertObjectExpression(lua, tokenStart, instance, true))); } else { Expression result; switch (LuaEmit.TryGetMember(instance, instance.Type, memberName, false, out result)) { case LuaTryGetMemberReturn.None: throw ParseError(tokenStart, LuaEmitException.GetMessageText(LuaEmitException.MemberNotFound, instance.Type.Name, memberName)); case LuaTryGetMemberReturn.NotReadable: throw ParseError(tokenStart, LuaEmitException.GetMessageText(LuaEmitException.CanNotReadMember, instance.Type.Name, memberName)); case LuaTryGetMemberReturn.ValidExpression: return(result); default: throw new ArgumentException("Internal return type of TryGetMember"); } } } // func MemberGetExpressionCore