youtube / spitfire

A high-performance Python template language
BSD 3-Clause "New" or "Revised" License
404 stars 58 forks source link

CacheNode not visited by optimizer #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
With both translate1 and translate2 in the function registry:

Source:

#set $a = 'a'
$translate1(a)
$translate2(123)

Compiled:

## translate1 ok:

 25     a = u'a'
 26     _buffer_write('%s' % _self_filter_function(translate1(a), translate1))
 27     _buffer_write(u'\n')
 28     if _cphAC9C6496 is None:

## translate2 not optmized: uses resolve_placeholder()

 29       _globals['_cphAC9C6496'] = 
_self_filter_function(resolve_placeholder('translate2', template=self, 
local_vars=locals(), global_vars=_globals)(123), 
resolve_placeholder('translate2', template=self, local_vars=locals(), 
global_vars=_globals))

This is because CacheNode doesn't get visited by the optimizer.

Original issue reported on code.google.com by shalabh....@gmail.com on 25 Jan 2010 at 7:30

GoogleCodeExporter commented 8 years ago
Fixed in 114.

Original comment by shalabh....@gmail.com on 25 Jan 2010 at 7:32