##// END OF EJS Templates
revset: remove redundant checks for parsed tree of alias...
Yuya Nishihara -
r28705:0e414895 default
parent child Browse files
Show More
@@ -335,7 +335,7 b' def getargsdict(x, funcname, keys):'
335 def isvalidsymbol(tree):
335 def isvalidsymbol(tree):
336 """Examine whether specified ``tree`` is valid ``symbol`` or not
336 """Examine whether specified ``tree`` is valid ``symbol`` or not
337 """
337 """
338 return tree[0] == 'symbol' and len(tree) > 1
338 return tree[0] == 'symbol'
339
339
340 def getsymbol(tree):
340 def getsymbol(tree):
341 """Get symbol name from valid ``symbol`` in ``tree``
341 """Get symbol name from valid ``symbol`` in ``tree``
@@ -347,7 +347,7 b' def getsymbol(tree):'
347 def isvalidfunc(tree):
347 def isvalidfunc(tree):
348 """Examine whether specified ``tree`` is valid ``func`` or not
348 """Examine whether specified ``tree`` is valid ``func`` or not
349 """
349 """
350 return tree[0] == 'func' and len(tree) > 1 and isvalidsymbol(tree[1])
350 return tree[0] == 'func' and isvalidsymbol(tree[1])
351
351
352 def getfuncname(tree):
352 def getfuncname(tree):
353 """Get function name from valid ``func`` in ``tree``
353 """Get function name from valid ``func`` in ``tree``
@@ -361,10 +361,7 b' def getfuncargs(tree):'
361
361
362 This assumes that ``tree`` is already examined by ``isvalidfunc``.
362 This assumes that ``tree`` is already examined by ``isvalidfunc``.
363 """
363 """
364 if len(tree) > 2:
364 return getlist(tree[2])
365 return getlist(tree[2])
366 else:
367 return []
368
365
369 def getset(repo, subset, x):
366 def getset(repo, subset, x):
370 if not x:
367 if not x:
@@ -2434,14 +2431,14 b' def _getalias(aliases, tree):'
2434 """If tree looks like an unexpanded alias, return it. Return None
2431 """If tree looks like an unexpanded alias, return it. Return None
2435 otherwise.
2432 otherwise.
2436 """
2433 """
2437 if isinstance(tree, tuple) and tree:
2434 if isinstance(tree, tuple):
2438 if tree[0] == 'symbol' and len(tree) == 2:
2435 if tree[0] == 'symbol':
2439 name = tree[1]
2436 name = tree[1]
2440 alias = aliases.get(name)
2437 alias = aliases.get(name)
2441 if alias and alias.args is None and alias.tree == tree:
2438 if alias and alias.args is None and alias.tree == tree:
2442 return alias
2439 return alias
2443 if tree[0] == 'func' and len(tree) > 1:
2440 if tree[0] == 'func':
2444 if tree[1][0] == 'symbol' and len(tree[1]) == 2:
2441 if tree[1][0] == 'symbol':
2445 name = tree[1][1]
2442 name = tree[1][1]
2446 alias = aliases.get(name)
2443 alias = aliases.get(name)
2447 if alias and alias.args is not None and alias.tree == tree[:2]:
2444 if alias and alias.args is not None and alias.tree == tree[:2]:
@@ -2452,7 +2449,7 b' def _expandargs(tree, args):'
2452 """Replace _aliasarg instances with the substitution value of the
2449 """Replace _aliasarg instances with the substitution value of the
2453 same name in args, recursively.
2450 same name in args, recursively.
2454 """
2451 """
2455 if not tree or not isinstance(tree, tuple):
2452 if not isinstance(tree, tuple):
2456 return tree
2453 return tree
2457 if tree[0] == '_aliasarg':
2454 if tree[0] == '_aliasarg':
2458 sym = tree[1]
2455 sym = tree[1]
General Comments 0
You need to be logged in to leave comments. Login now