Mercurial > octave
diff libinterp/parse-tree/oct-parse.yy @ 26794:287eba9ed14b
refactor predicates for classdef methods/constructors
* ov-fcn.h (octave_function::is_classdef_method,
octave_function::is_legacy_method,
octave_function::is_legacy_constructor): New virtual functions.
(octave_function::is_class_method): No longer virtual.
Return true if either is_classdef_method or is_legacy_method is true.
(octave_function::is_class_constructor): Likewise, for constructors.
* ov-usr-fcn.h, ov-usr-fcn.cc: Define separate functions for marking
and checking for legacy and classdef functions.
(octave_user_function::mark_as_legacy_constructor, ):
(octave_user_function::class_method_type): Rename from class_ctor_type.
(octave_user_function)::method_type_str): New function.
* oct-parse.yy (base_parser::start_function): Distinguish between
legacy and classdef methods and constructors when marking function
types.
* cdef-untils.cc (make_function_of_class): Mark function as classdef
constructor or method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 25 Feb 2019 20:10:06 +0000 |
parents | cf271740922a |
children | 0b17abf0ee9d |
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.yy Mon Feb 25 14:32:35 2019 +0000 +++ b/libinterp/parse-tree/oct-parse.yy Mon Feb 25 20:10:06 2019 +0000 @@ -3400,10 +3400,20 @@ if (m_lexer.m_parsing_class_method) { - if (m_curr_class_name == id_name) - fcn->mark_as_class_constructor (); + if (m_lexer.m_parsing_classdef) + { + if (m_curr_class_name == id_name) + fcn->mark_as_legacy_constructor (); + else + fcn->mark_as_legacy_method (); + } else - fcn->mark_as_class_method (); + { + if (m_curr_class_name == id_name) + fcn->mark_as_classdef_constructor (); + else + fcn->mark_as_classdef_method (); + } fcn->stash_dispatch_class (m_curr_class_name); }