Mercurial > octave
diff libinterp/parse-tree/oct-parse.yy @ 30259:03ff3f1020cf
store file name in classdef class object
* ov-classdef.h, ov-classdef.cc (octave_classdef_meta::file_name):
New function.
* pt-classdef.h, pt-classdef.cc (tree_classdef::m_file_name):
New data member.
(tree_classdef::tree_classdef): Also accept file name in constructor
argument list.
(tree_classdef::file_name): New function.
* oct-parse.yy (base_parser::make_classdef): Store full file name in
created tree_classdef object.
* cdef-class.h, cdef-class.cc (cdef_class_rep::file_name,
cdef_class::file_name): New functions.
(cdef_class:make_meta_class): Store file name in returned class object.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 30 Oct 2021 09:45:23 -0400 |
parents | c2c11605fa7a |
children | a2397a85d7e5 |
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.yy Sat Oct 30 13:03:02 2021 +0200 +++ b/libinterp/parse-tree/oct-parse.yy Sat Oct 30 09:45:23 2021 -0400 @@ -4305,14 +4305,16 @@ std::string cls_name = id->name (); - std::string nm = m_lexer.m_fcn_file_name; - - std::size_t pos = nm.find_last_of (sys::file_ops::dir_sep_chars ()); + std::string full_name = m_lexer.m_fcn_file_full_name; + std::string short_name = m_lexer.m_fcn_file_name; + + std::size_t pos + = short_name.find_last_of (sys::file_ops::dir_sep_chars ()); if (pos != std::string::npos) - nm = m_lexer.m_fcn_file_name.substr (pos+1); - - if (nm != cls_name) + short_name = short_name.substr (pos+1); + + if (short_name != cls_name) { int l = id->line (); int c = id->column (); @@ -4339,7 +4341,7 @@ retval = new tree_classdef (m_lexer.m_symtab_context.curr_scope (), a, id, sc, body, lc, tc, - m_curr_package_name, l, c); + m_curr_package_name, full_name, l, c); } else {