mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
slight optimization in the compilation of $smarty.const.FOO .
@FOO is less code and executed slightly faster than constant('FOO'). more complex consts like $smarty.const.$name still compile to constant($this->_tpl_vars['name'])
This commit is contained in:
3
NEWS
3
NEWS
@@ -1,3 +1,6 @@
|
||||
- make $smarty.const.FOO compile to "FOO", and not to "constant('foo')".
|
||||
this is less code and a little faster execution. note that undefined
|
||||
constants are now displayed as the constant's name. (messju)
|
||||
- make block functions and registered objects' block methods use a
|
||||
local variable for block_content instead of a property of $smarty (messju)
|
||||
- fix escaping in the generated code that calls smarty_core_load_plugins
|
||||
|
@@ -2031,8 +2031,12 @@ class Smarty_Compiler extends Smarty {
|
||||
return;
|
||||
}
|
||||
array_shift($indexes);
|
||||
$_val = $this->_parse_var_props(substr($indexes[0],1));
|
||||
$compiled_ref = '@constant(' . $_val . ')';
|
||||
if (preg_match('!^\.\w+$!', $indexes[0])) {
|
||||
$compiled_ref = '@' . substr($indexes[0], 1);
|
||||
} else {
|
||||
$_val = $this->_parse_var_props(substr($indexes[0], 1));
|
||||
$compiled_ref = '@constant(' . $_val . ')';
|
||||
}
|
||||
$_max_index = 1;
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user