Show More
@@ -332,29 +332,17 b' def getargsdict(x, funcname, keys):' | |||
|
332 | 332 | return parser.buildargsdict(getlist(x), funcname, keys.split(), |
|
333 | 333 | keyvaluenode='keyvalue', keynode='symbol') |
|
334 | 334 | |
|
335 | def isvalidsymbol(tree): | |
|
336 | """Examine whether specified ``tree`` is valid ``symbol`` or not | |
|
337 | """ | |
|
338 | return tree[0] == 'symbol' | |
|
339 | ||
|
340 | def getsymbol(tree): | |
|
341 | """Get symbol name from valid ``symbol`` in ``tree`` | |
|
342 | ||
|
343 | This assumes that ``tree`` is already examined by ``isvalidsymbol``. | |
|
344 | """ | |
|
345 | return tree[1] | |
|
346 | ||
|
347 | 335 | def isvalidfunc(tree): |
|
348 | 336 | """Examine whether specified ``tree`` is valid ``func`` or not |
|
349 | 337 | """ |
|
350 |
return tree[0] == 'func' and |
|
|
338 | return tree[0] == 'func' and tree[1][0] == 'symbol' | |
|
351 | 339 | |
|
352 | 340 | def getfuncname(tree): |
|
353 | 341 | """Get function name from valid ``func`` in ``tree`` |
|
354 | 342 | |
|
355 | 343 | This assumes that ``tree`` is already examined by ``isvalidfunc``. |
|
356 | 344 | """ |
|
357 |
return |
|
|
345 | return tree[1][1] | |
|
358 | 346 | |
|
359 | 347 | def getfuncargs(tree): |
|
360 | 348 | """Get list of function arguments from valid ``func`` in ``tree`` |
@@ -2319,9 +2307,9 b' def _parsealiasdecl(decl):' | |||
|
2319 | 2307 | raise error.ParseError(_('invalid token'), pos) |
|
2320 | 2308 | tree = parser.simplifyinfixops(tree, ('list',)) |
|
2321 | 2309 | |
|
2322 | if isvalidsymbol(tree): | |
|
2310 | if tree[0] == 'symbol': | |
|
2323 | 2311 | # "name = ...." style |
|
2324 |
name = |
|
|
2312 | name = tree[1] | |
|
2325 | 2313 | if name.startswith('$'): |
|
2326 | 2314 | return (decl, None, None, _("'$' not for alias arguments")) |
|
2327 | 2315 | return (name, ('symbol', name), None, None) |
@@ -2333,9 +2321,9 b' def _parsealiasdecl(decl):' | |||
|
2333 | 2321 | return (decl, None, None, _("'$' not for alias arguments")) |
|
2334 | 2322 | args = [] |
|
2335 | 2323 | for arg in getfuncargs(tree): |
|
2336 |
if |
|
|
2324 | if arg[0] != 'symbol': | |
|
2337 | 2325 | return (decl, None, None, _("invalid argument list")) |
|
2338 |
args.append( |
|
|
2326 | args.append(arg[1]) | |
|
2339 | 2327 | if len(args) != len(set(args)): |
|
2340 | 2328 | return (name, None, None, |
|
2341 | 2329 | _("argument names collide with each other")) |
General Comments 0
You need to be logged in to leave comments.
Login now