*fixed a referenced usertype cloning issue.

This commit is contained in:
Wang Renxin 2017-09-13 22:11:11 +08:00
parent 4eff522bcd
commit 3f570396c9
3 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,6 @@
Sep. 13 2017
Fixed a referenced usertype cloning issue
Aug. 29 2017
Added a prompting for inputer

View File

@ -32,13 +32,15 @@
#include "my_basic.h"
#if defined ARDUINO && !defined MB_CP_ARDUINO
# define MB_CP_ARDUINO
#endif /* ARDUINO && !MB_CP_ARDUINO */
#ifdef MB_CP_ARDUINO
# ifndef MB_DISABLE_LOAD_FILE
# define MB_DISABLE_LOAD_FILE
# endif /* MB_DISABLE_LOAD_FILE */
# ifndef MB_MANUAL_REAL_FORMATTING
# define MB_MANUAL_REAL_FORMATTING
# endif /* MB_MANUAL_REAL_FORMATTING */
#endif /* ARDUINO && !MB_CP_ARDUINO */
#endif /* MB_CP_ARDUINO */
#ifdef MB_CP_VC
# include <conio.h>
# include <locale.h>
@ -9212,6 +9214,12 @@ static int _clone_object(mb_interpreter_t* s, _object_t* obj, _object_t* tgt, bo
break;
#ifdef MB_ENABLE_USERTYPE_REF
case _DT_USERTYPE_REF:
if(!obj->data.usertype_ref->clone) {
tgt->type = MB_DT_NIL;
tgt->data.integer = 0;
break;
}
tgt->data.usertype_ref = _create_usertype_ref(
obj->data.usertype_ref->ref.s,
obj->data.usertype_ref->clone(obj->data.usertype_ref->ref.s, obj->data.usertype_ref->usertype),

View File

@ -30,7 +30,9 @@
extern "C" {
#endif /* __cplusplus */
#if defined __BORLANDC__
#if defined ARDUINO
# define MB_CP_ARDUINO
#elif defined __BORLANDC__
# define MB_CP_BORLANDC
#elif defined __clang__
# define MB_CP_CLANG