Mercurial > octave
diff libinterp/parse-tree/oct-parse.in.yy @ 24069:f8b8a8e6bd79
make local functions and method names unique for parser (Bug #52075)
* oct-parse.in.yy (fcn_name): Make ID unique by prepending
base_lexer::fcn_file_name + ">" to all local subfunctions before
calling parent_scope_info::name_current_scope.
* test/bug-52075/bug-52075.tst, test/bug-52075/class_bug52075.m,
test/bug-52075/module.mk: New files.
* test/module.mk: Update.
author | Piotr Held <pjheld@gmail.com> |
---|---|
date | Wed, 20 Sep 2017 15:34:33 -0700 |
parents | 5b88383b9a69 |
children | ff973f3e17e3 |
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.in.yy Thu Sep 21 16:56:01 2017 +0100 +++ b/libinterp/parse-tree/oct-parse.in.yy Wed Sep 20 15:34:33 2017 -0700 @@ -1513,6 +1513,13 @@ { std::string id = $1->name (); + // Make classdef local functions unique from + // classdef methods. + + if (parser.m_parsing_local_functions + && parser.m_curr_fcn_depth == 1) + id = lexer.fcn_file_name + ">" + id; + if (! parser.m_function_scopes.name_current_scope (id)) { parser.bison_error ("duplicate subfunction or nested function name",