Mercurial > hg > octave-nkf
changeset 17796:6b51f5f44aea
find symbols in proper scope when debugging (bug #40397)
* lex.h (lexical_feedback::symbol_table_context::init_scope):
Delete member variable and all uses.
(lexical_feedback::symbol_table_context::pop): Assert that the context
is not empty before popping.
(lexical_feedback::symbol_table_context::push): Use default argument.
(lexical_feedback::symbol_table_context::curr_scope): If empty, return
symbol_table::current_scope, not the initial scope in effect when the
object is created.
* oct-parse.in.yy (octave_base_parser::make_anon_fcn_handle,
octave_base_parser::recover_from_parsing_function):
Don't check for empty lexer.symtab_context here.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 29 Oct 2013 16:29:46 -0400 |
parents | 0a8c35ae5ce1 |
children | 06a850f83dd4 |
files | libinterp/parse-tree/lex.h libinterp/parse-tree/oct-parse.in.yy |
diffstat | 2 files changed, 6 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.h +++ b/libinterp/parse-tree/lex.h @@ -49,47 +49,37 @@ { public: - symbol_table_context (void) - : frame_stack (), init_scope (symbol_table::current_scope ()) - { - push (init_scope); - } + symbol_table_context (void) : frame_stack () { } void clear (void) { while (! frame_stack.empty ()) frame_stack.pop (); - - push (init_scope); } bool empty (void) const { return frame_stack.empty (); } void pop (void) { + if (empty ()) + panic_impossible (); + frame_stack.pop (); } - void push (symbol_table::scope_id scope) + void push (symbol_table::scope_id scope = symbol_table::current_scope ()) { frame_stack.push (scope); } - void push (void) - { - push (symbol_table::current_scope ()); - } - symbol_table::scope_id curr_scope (void) const { - return frame_stack.top (); + return empty () ? symbol_table::current_scope () : frame_stack.top (); } private: std::stack<symbol_table::scope_id> frame_stack; - - symbol_table::scope_id init_scope; }; // Track nesting of square brackets, curly braces, and parentheses.
--- a/libinterp/parse-tree/oct-parse.in.yy +++ b/libinterp/parse-tree/oct-parse.in.yy @@ -2074,9 +2074,6 @@ symbol_table::scope_id fcn_scope = lexer.symtab_context.curr_scope (); - if (lexer.symtab_context.empty ()) - panic_impossible (); - lexer.symtab_context.pop (); stmt->set_print_flag (false); @@ -2990,9 +2987,6 @@ void octave_base_parser::recover_from_parsing_function (void) { - if (lexer.symtab_context.empty ()) - panic_impossible (); - lexer.symtab_context.pop (); if (lexer.reading_fcn_file && curr_fcn_depth == 1