fixed: function and blocks were incorrectly cached
(now we have a tree in Item::Function.parameters too
and we should go through that tree as well)
fixed: in Generator: Item::Function.par should be cleared
only if Item::Function.name is not empty
changed: in Generator: use method 'write' of an output stream
instead of operator<<
added: Clear() method to Blocks class
changed: in Generator
Generator has its own Vars class now
we don't need SetVars() method
added: to Generator:
void CanUseCache(bool can_use_cache);
// set whether or not we can use cache for functions or blocks
// true by default
void CanUseVars(bool can_use_variables);
// set whether or not we can use variables: [def ...] statement
// true by default
git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@977 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
+18
-12
@@ -48,6 +48,23 @@ namespace Ezc
|
||||
{
|
||||
|
||||
|
||||
void Cache(Blocks & blocks, Item::Function & function)
|
||||
{
|
||||
function.item_block = 0;
|
||||
|
||||
if( !function.name.empty() && function.arg < 0 )
|
||||
{
|
||||
Blocks::Iterator i = blocks.Find(function.name);
|
||||
|
||||
if( i != blocks.End() )
|
||||
function.item_block = &i->second;
|
||||
}
|
||||
|
||||
for(size_t i=0 ; i < function.parameters.size() ; ++i)
|
||||
Cache(blocks, *function.parameters[i]);
|
||||
}
|
||||
|
||||
|
||||
void Cache(Blocks & blocks, Item & item)
|
||||
{
|
||||
// one exception (if_index is putting its argument on the functions stack)
|
||||
@@ -57,18 +74,7 @@ void Cache(Blocks & blocks, Item & item)
|
||||
if( item.type != Item::item_ifindex )
|
||||
{
|
||||
for(size_t f=0; f < item.functions.size() ; ++f)
|
||||
{
|
||||
Item::Function & function = item.functions[f];
|
||||
function.item_block = 0;
|
||||
|
||||
if( function.arg < 0 )
|
||||
{
|
||||
Blocks::Iterator b = blocks.Find(function.name);
|
||||
|
||||
if( b != blocks.End() )
|
||||
function.item_block = &b->second;
|
||||
}
|
||||
}
|
||||
Cache(blocks, item.functions[f]);
|
||||
}
|
||||
|
||||
for(size_t i=0; i < item.item_tab.size() ; ++i)
|
||||
|
||||
Reference in New Issue
Block a user