mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14: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
|
- make block functions and registered objects' block methods use a
|
||||||
local variable for block_content instead of a property of $smarty (messju)
|
local variable for block_content instead of a property of $smarty (messju)
|
||||||
- fix escaping in the generated code that calls smarty_core_load_plugins
|
- fix escaping in the generated code that calls smarty_core_load_plugins
|
||||||
|
@@ -2031,8 +2031,12 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
array_shift($indexes);
|
array_shift($indexes);
|
||||||
$_val = $this->_parse_var_props(substr($indexes[0],1));
|
if (preg_match('!^\.\w+$!', $indexes[0])) {
|
||||||
$compiled_ref = '@constant(' . $_val . ')';
|
$compiled_ref = '@' . substr($indexes[0], 1);
|
||||||
|
} else {
|
||||||
|
$_val = $this->_parse_var_props(substr($indexes[0], 1));
|
||||||
|
$compiled_ref = '@constant(' . $_val . ')';
|
||||||
|
}
|
||||||
$_max_index = 1;
|
$_max_index = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user