From bcd5743ada3818585070fe676bfc7f53d31ae8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Wed, 17 Mar 1999 13:51:59 -0800 Subject: [PATCH] bugfix in inherit Rev: src/program.c:1.118 Rev: src/program.h:1.53 --- src/program.c | 21 ++++++++++++++------- src/program.h | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/program.c b/src/program.c index 471d4426d3..fefee574b3 100644 --- a/src/program.c +++ b/src/program.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: program.c,v 1.117 1999/03/15 08:24:01 hubbe Exp $"); +RCSID("$Id: program.c,v 1.118 1999/03/17 21:51:57 hubbe Exp $"); #include "program.h" #include "object.h" #include "dynamic_buffer.h" @@ -614,15 +614,20 @@ void low_start_new_program(struct program *p, add_ref(compiler_frame->current_return_type=void_type_string); #ifdef PIKE_DEBUG - if(lex.current_file) - store_linenumber(last_pc, lex.current_file); #endif } -void start_new_program(void) +void debug_start_new_program(PROGRAM_LINE_ARGS) { /* fprintf(stderr, "start_new_program(): threads_disabled:%d, compilation_depth:%d\n", threads_disabled, compilation_depth); */ low_start_new_program(0,0,0); +#ifdef PIKE_DEBUG + { + struct pike_string *s=make_shared_string(file); + store_linenumber(line,s); + free_string(s); + } +#endif } @@ -1229,6 +1234,7 @@ void low_inherit(struct program *p, } }else{ inherit.parent_offset+=parent_offset; + inherit.parent_identifier=parent_identifier; } }else{ if(parent && parent->next != parent && inherit.parent_offset) @@ -1258,7 +1264,6 @@ void low_inherit(struct program *p, } inherit.parent=par; - inherit.parent_identifier=pid; inherit.parent_offset=0; }else{ inherit.parent_offset+=parent_offset; @@ -1376,7 +1381,7 @@ void compiler_do_inherit(node *n, low_inherit(p, 0, - 0, + numid, n->u.integer.a, flags, name); @@ -2380,7 +2385,9 @@ struct program *compile(struct pike_string *prog) lex.current_file=make_shared_string("-"); lex.pragmas=0; - start_new_program(); + low_start_new_program(0,0,0); + if(lex.current_file) + store_linenumber(last_pc, lex.current_file); compilation_depth=0; /* start_line_numbering(); */ diff --git a/src/program.h b/src/program.h index 0735f72c05..11aeb87e32 100644 --- a/src/program.h +++ b/src/program.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: program.h,v 1.52 1999/03/11 22:59:21 grubba Exp $ + * $Id: program.h,v 1.53 1999/03/17 21:51:59 hubbe Exp $ */ #ifndef PROGRAM_H #define PROGRAM_H @@ -17,6 +17,12 @@ #include "svalue.h" #include "time_stuff.h" +#ifdef PIKE_DEBUG +#define PROGRAM_LINE_ARGS int line, char *file +#else +#define PROGRAM_LINE_ARGS void +#endif + #define LFUN___INIT 0 #define LFUN_CREATE 1 #define LFUN_DESTROY 2 @@ -273,7 +279,7 @@ struct program *low_allocate_program(void); void low_start_new_program(struct program *p, struct pike_string *name, int flags); -void start_new_program(void); +void debug_start_new_program(PROGRAM_LINE_ARGS); void really_free_program(struct program *p); void dump_program_desc(struct program *p); int sizeof_variable(int run_time_type); @@ -422,3 +428,10 @@ int implements(struct program *a, struct program *b); #define end_class(NAME,FLAGS) debug_end_class(NAME, CONSTANT_STRLEN(NAME), FLAGS) #define end_program debug_end_program #endif + + +#ifdef PIKE_DEBUG +#define start_new_program() debug_start_new_program(__LINE__,__FILE__) +#else +#define start_new_program() debug_start_new_program() +#endif -- GitLab