summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-09-17 20:16:30 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-09-17 20:16:30 (GMT)
commiteab4328f1a4de03e527c746086f73c8a4d6f6b08 (patch)
tree87891e1209cae9dc9f1616db4cfe871bf98f5165 /Tools
parent2e4cc7e0d84747826d3d2546d1bccd9c40a455c2 (diff)
downloadcpython-eab4328f1a4de03e527c746086f73c8a4d6f6b08.zip
cpython-eab4328f1a4de03e527c746086f73c8a4d6f6b08.tar.gz
cpython-eab4328f1a4de03e527c746086f73c8a4d6f6b08.tar.bz2
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.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/compiler/astgen.py6
-rw-r--r--Tools/compiler/compiler/astgen.py6
2 files changed, 6 insertions, 6 deletions
diff --git a/Tools/compiler/astgen.py b/Tools/compiler/astgen.py
index 245eebd..90201d3 100644
--- a/Tools/compiler/astgen.py
+++ b/Tools/compiler/astgen.py
@@ -71,15 +71,15 @@ class NodeInfo:
if arg.endswith('*'):
arg = self.argnames[i] = arg[:-1]
d[arg] = P_OTHER
- hardest_arg = P_OTHER
+ hardest_arg = max(hardest_arg, P_OTHER)
elif arg.endswith('!'):
arg = self.argnames[i] = arg[:-1]
d[arg] = P_NESTED
- hardest_arg = P_NESTED
+ hardest_arg = max(hardest_arg, P_NESTED)
elif arg.endswith('&'):
arg = self.argnames[i] = arg[:-1]
d[arg] = P_NONE
- hardest_arg = P_NONE
+ hardest_arg = max(hardest_arg, P_NONE)
else:
d[arg] = P_NODE
self.hardest_arg = hardest_arg
diff --git a/Tools/compiler/compiler/astgen.py b/Tools/compiler/compiler/astgen.py
index 245eebd..90201d3 100644
--- a/Tools/compiler/compiler/astgen.py
+++ b/Tools/compiler/compiler/astgen.py
@@ -71,15 +71,15 @@ class NodeInfo:
if arg.endswith('*'):
arg = self.argnames[i] = arg[:-1]
d[arg] = P_OTHER
- hardest_arg = P_OTHER
+ hardest_arg = max(hardest_arg, P_OTHER)
elif arg.endswith('!'):
arg = self.argnames[i] = arg[:-1]
d[arg] = P_NESTED
- hardest_arg = P_NESTED
+ hardest_arg = max(hardest_arg, P_NESTED)
elif arg.endswith('&'):
arg = self.argnames[i] = arg[:-1]
d[arg] = P_NONE
- hardest_arg = P_NONE
+ hardest_arg = max(hardest_arg, P_NONE)
else:
d[arg] = P_NODE
self.hardest_arg = hardest_arg