##// END OF EJS Templates
parser: reorder alias expansion routine to return early...
Yuya Nishihara -
r28896:4c76a032 default
parent child Browse files
Show More
@@ -509,31 +509,29 b' class basealiasrules(object):'
509 509 if not isinstance(tree, tuple):
510 510 return tree
511 511 a = cls._getalias(aliases, tree)
512 if a is not None:
512 if a is None:
513 return tuple(cls._expand(aliases, t, expanding, cache)
514 for t in tree)
513 515 if a.error:
514 516 raise error.Abort(a.error)
515 517 if a in expanding:
516 518 raise error.ParseError(_('infinite expansion of %(section)s '
517 519 '"%(name)s" detected')
518 % {'section': cls._section,
519 'name': a.name})
520 % {'section': cls._section, 'name': a.name})
520 521 expanding.append(a)
521 522 if a.name not in cache:
522 523 cache[a.name] = cls._expand(aliases, a.replacement, expanding,
523 524 cache)
524 525 result = cache[a.name]
525 526 expanding.pop()
526 if a.args is not None:
527 if a.args is None:
528 return result
527 529 l = cls._getlist(tree[2])
528 530 if len(l) != len(a.args):
529 531 raise error.ParseError(_('invalid number of arguments: %d')
530 532 % len(l))
531 533 l = [cls._expand(aliases, t, [], cache) for t in l]
532 result = cls._expandargs(result, dict(zip(a.args, l)))
533 else:
534 result = tuple(cls._expand(aliases, t, expanding, cache)
535 for t in tree)
536 return result
534 return cls._expandargs(result, dict(zip(a.args, l)))
537 535
538 536 @classmethod
539 537 def expand(cls, aliases, tree):
General Comments 0
You need to be logged in to leave comments. Login now