comparison mercurial/templateutil.py @ 37162:53e6b7e05553

templater: drop bool support from evalastype() Future patches will split evalastype() into two functions, evalrawexp() and unwrapastype(), so we can catch the exception of type conversion. # evaluating function may bubble up inner ParseError thing = evalrawexp(context, mapping, arg) try: return unwrapastype(context, thing) except ParseError: # add hint and reraise However, evalboolean() can't be factored out in this way since it has to process boolean-like symbols as non keyword. Fortunately, it's unlikely that we'll need a general type converter supporting bool, so this patch drops it from the table.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 23 Mar 2018 20:23:55 +0900
parents e09d2183e226
children 0023da2910c9
comparison
equal deleted inserted replaced
37161:b56b79185aad 37162:53e6b7e05553
331 else: 331 else:
332 thing = func(context, mapping, data) 332 thing = func(context, mapping, data)
333 return stringify(thing) 333 return stringify(thing)
334 334
335 _evalfuncbytype = { 335 _evalfuncbytype = {
336 bool: evalboolean,
337 bytes: evalstring, 336 bytes: evalstring,
338 int: evalinteger, 337 int: evalinteger,
339 } 338 }
340 339
341 def evalastype(context, mapping, arg, typ): 340 def evalastype(context, mapping, arg, typ):