Mercurial > octave
view test/bug-53027/ntest53027b.m @ 24982:c16ad80274c9 stable
improve previous fix for clear in nested scopes (bug #53027)
* symrec.h (symbol_record::unbind_fwd_rep): New arg, recurse.
(symbol_record::symbol_record_rep::unbind_fwd_rep): New arg, recurse.
If TRUE, recurse to find ultimate rep.
* symscope.cc (symbol_scope_rep::unbind_script_symbols): Don't recurse
when unbinding script symbols.
* symscope.h (symbol_record_rep::clear_varaible,
symbol_record_rep::clear_variable_pattern,
symbol_record_rep::clear_variable_regexp):
If scope is nested, check parent for symbols.
* test/bug-53027/globals53027.m, test/bug-53027/gtest53027.m:
New test scripts.
* test/bug-53027/ntest53027c.m: New test function.
* test/bug-53027/ntest53027b.m: Fix typo.
* test/bug-53027/bug-53027.tst: Update.
* test/bug-53027/module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 22 Mar 2018 23:24:21 -0400 |
parents | 2b040946dc69 |
children |
line wrap: on
line source
function [m_exist, n_exist] = ntest53027b () global x x = 3; n_exist = nest (); m_exist = exist ("x", 'var'); function n_exist = nest () ## The clear statement should operate on the variable in the ## parent scope even though there is no explicit varabiable ## reference in the code (the clear function just sees a string ## containing the name of the variable and the parser (correctly) ## does not treat this as a special case. clear x n_exist = exist ("x", "var"); endfunction endfunction