# HG changeset patch # User Yuya Nishihara # Date 2016-02-29 07:35:58 # Node ID af5f90f23515bbaa386cff3dd6d71c117889d585 # Parent b33ca687c1e3c1abbddd188135bb9f9b2089fe56 revset: inline isvalidfunc(), getfuncname() and getfuncargs() See the previous commit for why. These functions are also trivial. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -332,25 +332,6 @@ def getargsdict(x, funcname, keys): return parser.buildargsdict(getlist(x), funcname, keys.split(), keyvaluenode='keyvalue', keynode='symbol') -def isvalidfunc(tree): - """Examine whether specified ``tree`` is valid ``func`` or not - """ - return tree[0] == 'func' and tree[1][0] == 'symbol' - -def getfuncname(tree): - """Get function name from valid ``func`` in ``tree`` - - This assumes that ``tree`` is already examined by ``isvalidfunc``. - """ - return tree[1][1] - -def getfuncargs(tree): - """Get list of function arguments from valid ``func`` in ``tree`` - - This assumes that ``tree`` is already examined by ``isvalidfunc``. - """ - return getlist(tree[2]) - def getset(repo, subset, x): if not x: raise error.ParseError(_("missing argument")) @@ -2314,13 +2295,13 @@ def _parsealiasdecl(decl): return (decl, None, None, _("'$' not for alias arguments")) return (name, ('symbol', name), None, None) - if isvalidfunc(tree): + if tree[0] == 'func' and tree[1][0] == 'symbol': # "name(arg, ....) = ...." style - name = getfuncname(tree) + name = tree[1][1] if name.startswith('$'): return (decl, None, None, _("'$' not for alias arguments")) args = [] - for arg in getfuncargs(tree): + for arg in getlist(tree[2]): if arg[0] != 'symbol': return (decl, None, None, _("invalid argument list")) args.append(arg[1])