changeset 26125:c990afab2243

templater: drop unneeded destructuring of argument tuple at buildfilter Because evalfuncarg() accepts an argument tuple, there is little meaning to pass (func, data, filt) in place of ((func, data), filt).
author Yuya Nishihara <yuya@tcha.org>
date Tue, 01 Sep 2015 19:04:10 +0900
parents 604a7c941103
children 7b625baed995
files mercurial/templater.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Tue Sep 01 18:57:50 2015 +0900
+++ b/mercurial/templater.py	Tue Sep 01 19:04:10 2015 +0900
@@ -256,26 +256,26 @@
         yield func(context, mapping, data)
 
 def buildfilter(exp, context):
-    func, data = compileexp(exp[1], context, methods)
+    arg = compileexp(exp[1], context, methods)
     n = getsymbol(exp[2])
     if n in context._filters:
         filt = context._filters[n]
-        return (runfilter, (func, data, filt))
+        return (runfilter, (arg, filt))
     if n in funcs:
         f = funcs[n]
-        return (f, [(func, data)])
+        return (f, [arg])
     raise error.ParseError(_("unknown function '%s'") % n)
 
 def runfilter(context, mapping, data):
-    func, data, filt = data
-    thing = evalfuncarg(context, mapping, (func, data))
+    arg, filt = data
+    thing = evalfuncarg(context, mapping, arg)
     try:
         return filt(thing)
     except (ValueError, AttributeError, TypeError):
-        if isinstance(data, tuple):
-            dt = data[1]
+        if isinstance(arg[1], tuple):
+            dt = arg[1][1]
         else:
-            dt = data
+            dt = arg[1]
         raise util.Abort(_("template filter '%s' is not compatible with "
                            "keyword '%s'") % (filt.func_name, dt))
 
@@ -313,7 +313,7 @@
         if len(args) != 1:
             raise error.ParseError(_("filter %s expects one argument") % n)
         f = context._filters[n]
-        return (runfilter, (args[0][0], args[0][1], f))
+        return (runfilter, (args[0], f))
     raise error.ParseError(_("unknown function '%s'") % n)
 
 def date(context, mapping, args):