mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Fix calculation of hardest_arg.
The argument properties are ordered from easiest to hardest. The harder the arg, the more complicated that code that must be generated to return it from getChildren() and/or getChildNodes(). The old calculation routine was bogus, because it always set hardest_arg to the hardness of the last argument. Now use max() to always set it to the hardness of the hardest argument.
This commit is contained in:
parent
2e4cc7e0d8
commit
eab4328f1a
2 changed files with 6 additions and 6 deletions
|
@ -71,15 +71,15 @@ class NodeInfo:
|
||||||
if arg.endswith('*'):
|
if arg.endswith('*'):
|
||||||
arg = self.argnames[i] = arg[:-1]
|
arg = self.argnames[i] = arg[:-1]
|
||||||
d[arg] = P_OTHER
|
d[arg] = P_OTHER
|
||||||
hardest_arg = P_OTHER
|
hardest_arg = max(hardest_arg, P_OTHER)
|
||||||
elif arg.endswith('!'):
|
elif arg.endswith('!'):
|
||||||
arg = self.argnames[i] = arg[:-1]
|
arg = self.argnames[i] = arg[:-1]
|
||||||
d[arg] = P_NESTED
|
d[arg] = P_NESTED
|
||||||
hardest_arg = P_NESTED
|
hardest_arg = max(hardest_arg, P_NESTED)
|
||||||
elif arg.endswith('&'):
|
elif arg.endswith('&'):
|
||||||
arg = self.argnames[i] = arg[:-1]
|
arg = self.argnames[i] = arg[:-1]
|
||||||
d[arg] = P_NONE
|
d[arg] = P_NONE
|
||||||
hardest_arg = P_NONE
|
hardest_arg = max(hardest_arg, P_NONE)
|
||||||
else:
|
else:
|
||||||
d[arg] = P_NODE
|
d[arg] = P_NODE
|
||||||
self.hardest_arg = hardest_arg
|
self.hardest_arg = hardest_arg
|
||||||
|
|
|
@ -71,15 +71,15 @@ class NodeInfo:
|
||||||
if arg.endswith('*'):
|
if arg.endswith('*'):
|
||||||
arg = self.argnames[i] = arg[:-1]
|
arg = self.argnames[i] = arg[:-1]
|
||||||
d[arg] = P_OTHER
|
d[arg] = P_OTHER
|
||||||
hardest_arg = P_OTHER
|
hardest_arg = max(hardest_arg, P_OTHER)
|
||||||
elif arg.endswith('!'):
|
elif arg.endswith('!'):
|
||||||
arg = self.argnames[i] = arg[:-1]
|
arg = self.argnames[i] = arg[:-1]
|
||||||
d[arg] = P_NESTED
|
d[arg] = P_NESTED
|
||||||
hardest_arg = P_NESTED
|
hardest_arg = max(hardest_arg, P_NESTED)
|
||||||
elif arg.endswith('&'):
|
elif arg.endswith('&'):
|
||||||
arg = self.argnames[i] = arg[:-1]
|
arg = self.argnames[i] = arg[:-1]
|
||||||
d[arg] = P_NONE
|
d[arg] = P_NONE
|
||||||
hardest_arg = P_NONE
|
hardest_arg = max(hardest_arg, P_NONE)
|
||||||
else:
|
else:
|
||||||
d[arg] = P_NODE
|
d[arg] = P_NODE
|
||||||
self.hardest_arg = hardest_arg
|
self.hardest_arg = hardest_arg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue