# HG changeset patch # User Paul Boddie # Date 1490733979 -7200 # Node ID 9ec1872daea4c470bb8a2915b2655967b2811e82 # Parent 78554ece62b2c362f6766b6a776ce2fa4b2fd1de Changed the location notations and added output of alias information. diff -r 78554ece62b2 -r 9ec1872daea4 deducer.py --- a/deducer.py Tue Mar 28 22:12:11 2017 +0200 +++ b/deducer.py Tue Mar 28 22:46:19 2017 +0200 @@ -205,7 +205,7 @@ Locations have the following format: - qualified name of scope "." local name ":" name version + qualified name of scope ":" local name ":" name version The attribute type can be "", "", "" or "<>", where the latter indicates an absence of suitable references. @@ -238,12 +238,19 @@ location " " ( "specific" | "common" ) " " object kind " " object types Object kind can be "", "" or "". + + ---- + + A summary of aliases is formatted as follows: + + location " " locations """ f_type_summary = open(join(self.output, "type_summary"), "w") f_types = open(join(self.output, "types"), "w") f_warnings = open(join(self.output, "type_warnings"), "w") f_guards = open(join(self.output, "guards"), "w") + f_aliases = open(join(self.output, "aliases"), "w") try: locations = self.accessor_class_types.keys() @@ -304,11 +311,24 @@ print >>f_type_summary, encode_location(location), encode_constrained(constrained), \ guard_test and "-".join(guard_test) or "unguarded", sorted_output(all_general_types), len(all_types) + # Aliases are visited separately from accessors, even though they + # are often the same thing. + + locations = self.alias_index.keys() + locations.sort() + + for location in locations: + accesses = [] + for access_location in self.alias_index[location]: + accesses.append(encode_access_location(access_location)) + print >>f_aliases, encode_location(location), ", ".join(accesses) + finally: f_type_summary.close() f_types.close() f_warnings.close() f_guards.close() + f_aliases.close() def write_accesses(self): @@ -322,7 +342,7 @@ Locations have the following format: - qualified name of scope "." local name " " attribute name ":" access number + qualified name of scope ":" local name ":" attribute name ":" access number The attribute type can be "", "", "" or "<>", where the latter indicates an absence of suitable references. diff -r 78554ece62b2 -r 9ec1872daea4 encoders.py --- a/encoders.py Tue Mar 28 22:12:11 2017 +0200 +++ b/encoders.py Tue Mar 28 22:46:19 2017 +0200 @@ -77,7 +77,7 @@ "Encode the access location 't'." path, name, attrname, version = t - return "%s %s %s:%d" % (path, name or "{}", attrname, version) + return "%s:%s:%s:%d" % (path, name or "{}", attrname or "{}", version) def encode_location(t): @@ -85,11 +85,11 @@ path, name, attrname, version = t if name is not None and version is not None: - return "%s %s:%d" % (path, name, version) + return "%s:%s:%d" % (path, name, version) elif name is not None: - return "%s %s" % (path, name) + return "%s:%s" % (path, name) else: - return "%s :%s" % (path, attrname) + return "%s::%s" % (path, attrname) def encode_modifiers(modifiers):