[PATCH 1 of 5] templater: do dict lookup over a wrapped object
Yuya Nishihara
yuya at tcha.org
Tue Jun 5 13:18:55 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1521562709 -32400
# Wed Mar 21 01:18:29 2018 +0900
# Node ID f028d9f94272b971eafc60582af15d83cc9a8f4a
# Parent 2b8c8b8d1a0698c7b045053806368c9a05ee9fd0
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.
diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py
--- a/mercurial/templatefuncs.py
+++ b/mercurial/templatefuncs.py
@@ -261,7 +261,7 @@ def get(context, mapping, args):
# 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"))
diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py
--- a/mercurial/templateutil.py
+++ b/mercurial/templateutil.py
@@ -662,7 +662,7 @@ def runmap(context, mapping, data):
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)
More information about the Mercurial-devel
mailing list