Show More
@@ -270,25 +270,6 b' def _match(patspec, tree):' | |||
|
270 | 270 | return parser.matchtree(pattern, tree, ('symbol', '_'), |
|
271 | 271 | {'keyvalue', 'list'}) |
|
272 | 272 | |
|
273 | def _isnamedfunc(x, funcname): | |
|
274 | """Check if given tree matches named function""" | |
|
275 | return x and x[0] == 'func' and getsymbol(x[1]) == funcname | |
|
276 | ||
|
277 | def _isposargs(x, n): | |
|
278 | """Check if given tree is n-length list of positional arguments""" | |
|
279 | l = getlist(x) | |
|
280 | return len(l) == n and all(y and y[0] != 'keyvalue' for y in l) | |
|
281 | ||
|
282 | def _matchnamedfunc(x, funcname): | |
|
283 | """Return args tree if given tree matches named function; otherwise None | |
|
284 | ||
|
285 | This can't be used for testing a nullary function since its args tree | |
|
286 | is also None. Use _isnamedfunc() instead. | |
|
287 | """ | |
|
288 | if not _isnamedfunc(x, funcname): | |
|
289 | return | |
|
290 | return x[2] | |
|
291 | ||
|
292 | 273 | def _matchonly(revs, bases): |
|
293 | 274 | return _match('ancestors(_) and not ancestors(_)', ('and', revs, bases)) |
|
294 | 275 |
General Comments 0
You need to be logged in to leave comments.
Login now