comparison mercurial/revset.py @ 28708:ab06b5ef93f7

revset: make _parsealiasdecl() simply return the original parsed tree It wasn't necessary to reconstruct the same tuple.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 29 Feb 2016 17:46:06 +0900
parents af5f90f23515
children c5f212c8ad78
comparison
equal deleted inserted replaced
28707:af5f90f23515 28708:ab06b5ef93f7
2291 if tree[0] == 'symbol': 2291 if tree[0] == 'symbol':
2292 # "name = ...." style 2292 # "name = ...." style
2293 name = tree[1] 2293 name = tree[1]
2294 if name.startswith('$'): 2294 if name.startswith('$'):
2295 return (decl, None, None, _("'$' not for alias arguments")) 2295 return (decl, None, None, _("'$' not for alias arguments"))
2296 return (name, ('symbol', name), None, None) 2296 return (name, tree, None, None)
2297 2297
2298 if tree[0] == 'func' and tree[1][0] == 'symbol': 2298 if tree[0] == 'func' and tree[1][0] == 'symbol':
2299 # "name(arg, ....) = ...." style 2299 # "name(arg, ....) = ...." style
2300 name = tree[1][1] 2300 name = tree[1][1]
2301 if name.startswith('$'): 2301 if name.startswith('$'):
2306 return (decl, None, None, _("invalid argument list")) 2306 return (decl, None, None, _("invalid argument list"))
2307 args.append(arg[1]) 2307 args.append(arg[1])
2308 if len(args) != len(set(args)): 2308 if len(args) != len(set(args)):
2309 return (name, None, None, 2309 return (name, None, None,
2310 _("argument names collide with each other")) 2310 _("argument names collide with each other"))
2311 return (name, ('func', ('symbol', name)), args, None) 2311 return (name, tree[:2], args, None)
2312 2312
2313 return (decl, None, None, _("invalid format")) 2313 return (decl, None, None, _("invalid format"))
2314 except error.ParseError as inst: 2314 except error.ParseError as inst:
2315 return (decl, None, None, parseerrordetail(inst)) 2315 return (decl, None, None, parseerrordetail(inst))
2316 2316