##// END OF EJS Templates
templater: inline compiletemplate() function into engine...
Yuya Nishihara -
r28956:eea98190 default
parent child Browse files
Show More
@@ -247,11 +247,8 b' def _parseexpr(expr):'
247 def prettyformat(tree):
247 def prettyformat(tree):
248 return parser.prettyformat(tree, ('integer', 'string', 'symbol'))
248 return parser.prettyformat(tree, ('integer', 'string', 'symbol'))
249
249
250 def compiletemplate(tmpl, context):
251 """Parse and compile template string to (func, data) pair"""
252 return compileexp(parse(tmpl), context, methods)
253
254 def compileexp(exp, context, curmethods):
250 def compileexp(exp, context, curmethods):
251 """Compile parsed template tree to (func, data) pair"""
255 t = exp[0]
252 t = exp[0]
256 if t in curmethods:
253 if t in curmethods:
257 return curmethods[t](exp, context)
254 return curmethods[t](exp, context)
@@ -955,7 +952,8 b' class engine(object):'
955 # put poison to cut recursion while compiling 't'
952 # put poison to cut recursion while compiling 't'
956 self._cache[t] = (_runrecursivesymbol, t)
953 self._cache[t] = (_runrecursivesymbol, t)
957 try:
954 try:
958 self._cache[t] = compiletemplate(self._loader(t), self)
955 x = parse(self._loader(t))
956 self._cache[t] = compileexp(x, self, methods)
959 except: # re-raises
957 except: # re-raises
960 del self._cache[t]
958 del self._cache[t]
961 raise
959 raise
General Comments 0
You need to be logged in to leave comments. Login now