changeset 38240:c2456a7726c1

templater: do dict lookup over a wrapped object Dict/list lookup operations will be moved to a wrapped interface so that a returned element can inherit hybrid-ness automatically. wraphybridvalue() will be inlined.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 21 Mar 2018 01:18:29 +0900
parents ead71b15efd5
children ad06a4264daf
files mercurial/templatefuncs.py mercurial/templateutil.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatefuncs.py	Wed Jun 06 13:31:24 2018 -0400
+++ b/mercurial/templatefuncs.py	Wed Mar 21 01:18:29 2018 +0900
@@ -261,7 +261,7 @@
         # i18n: "get" is a keyword
         raise error.ParseError(_("get() expects two arguments"))
 
-    dictarg = evalfuncarg(context, mapping, args[0])
+    dictarg = evalwrapped(context, mapping, args[0])
     if not util.safehasattr(dictarg, 'get'):
         # i18n: "get" is a keyword
         raise error.ParseError(_("get() expects a dict as first argument"))
--- a/mercurial/templateutil.py	Wed Jun 06 13:31:24 2018 -0400
+++ b/mercurial/templateutil.py	Wed Mar 21 01:18:29 2018 +0900
@@ -662,7 +662,7 @@
 
 def runmember(context, mapping, data):
     darg, memb = data
-    d = evalrawexp(context, mapping, darg)
+    d = evalwrapped(context, mapping, darg)
     if util.safehasattr(d, 'tomap'):
         lm = context.overlaymap(mapping, d.tomap())
         return runsymbol(context, lm, memb)