*fixed a missing source file information issue for routine.

This commit is contained in:
Wang Renxin 2016-07-11 12:29:46 +08:00 committed by GitHub
parent 6de74f25cb
commit 7967fc5791

View File

@ -7849,8 +7849,10 @@ static _routine_t* _clone_routine(_routine_t* sub, void* c, bool_t toupval) {
if(!result) { if(!result) {
result = (_routine_t*)mb_malloc(sizeof(_routine_t)); result = (_routine_t*)mb_malloc(sizeof(_routine_t));
memset(result, 0, sizeof(_routine_t)); memset(result, 0, sizeof(_routine_t));
if(sub->name) result->name = sub->name;
result->name = mb_strdup(sub->name, 0); #ifdef MB_ENABLE_SOURCE_TRACE
result->source_file = sub->source_file;
#endif /* MB_ENABLE_SOURCE_TRACE */
#ifdef MB_ENABLE_CLASS #ifdef MB_ENABLE_CLASS
result->instance = instance; result->instance = instance;
#endif /* MB_ENABLE_CLASS */ #endif /* MB_ENABLE_CLASS */
@ -7894,6 +7896,7 @@ static void _destroy_routine(mb_interpreter_t* s, _routine_t* r) {
mb_assert(r); mb_assert(r);
if(s) gc = &s->gc; if(s) gc = &s->gc;
if(!r->is_cloned) {
if(r->name) { if(r->name) {
safe_free(r->name); safe_free(r->name);
} }
@ -7902,7 +7905,6 @@ static void _destroy_routine(mb_interpreter_t* s, _routine_t* r) {
safe_free(r->source_file); safe_free(r->source_file);
} }
#endif /* MB_ENABLE_SOURCE_TRACE */ #endif /* MB_ENABLE_SOURCE_TRACE */
if(!r->is_cloned) {
switch(r->type) { switch(r->type) {
case _IT_SCRIPT: case _IT_SCRIPT:
if(r->func.basic.scope) { if(r->func.basic.scope) {