mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:05:39 +08:00
Default scope for variables is innermost function block
darcs-hash:20050926145426-ac50b-ebe8f1af0ee60728d71a8df326b89ed6575560c6.gz
This commit is contained in:
parent
0ef22a5577
commit
0a87af38f9
|
@ -4,6 +4,8 @@
|
|||
|
||||
* env.c, builtin_set.c (env_exist, env_get, env_set, builtin_set): Add support for zero element arrays
|
||||
|
||||
* env.c (env_set): Default scope for variables is innermost function block
|
||||
|
||||
2005-09-25 Axel Liljencrantz <axel@liljencrantz.se>
|
||||
|
||||
* parser.c: (parse_job, parser_skip_arguemnts, paresr_Test): No semicolon required after else and begin
|
||||
|
|
8
env.c
8
env.c
|
@ -377,7 +377,7 @@ void env_set( const wchar_t *key,
|
|||
}
|
||||
|
||||
node = env_get_node( key );
|
||||
if( &node->env != 0 )
|
||||
if( node && &node->env != 0 )
|
||||
{
|
||||
e = (var_entry_t *) hash_get( &node->env,
|
||||
key );
|
||||
|
@ -425,7 +425,13 @@ void env_set( const wchar_t *key,
|
|||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
New variable with unspecified scope. The default scope is the innermost scope that is shadowing
|
||||
*/
|
||||
node = top;
|
||||
while( node->next && !node->new_scope )
|
||||
node = node->next;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user