1.1 --- a/referencing.py Tue Dec 06 22:58:16 2016 +0100
1.2 +++ b/referencing.py Wed Dec 07 01:05:36 2016 +0100
1.3 @@ -125,11 +125,14 @@
1.4 static = self.static()
1.5 return static and static.origin or None
1.6
1.7 - def instance_of(self):
1.8 + def instance_of(self, alias=None):
1.9
1.10 - "Return a reference to an instance of the referenced class."
1.11 + """
1.12 + Return a reference to an instance of the referenced class, indicating an
1.13 + 'alias' for the instance if specified.
1.14 + """
1.15
1.16 - return self.has_kind("<class>") and Reference("<instance>", self.origin) or None
1.17 + return self.has_kind("<class>") and Reference("<instance>", self.origin, alias) or None
1.18
1.19 def as_var(self):
1.20
1.21 @@ -196,6 +199,13 @@
1.22
1.23 return ancestors
1.24
1.25 + def is_constant_alias(self):
1.26 +
1.27 + "Return whether this reference is an alias for a constant."
1.28 +
1.29 + name = self.get_name()
1.30 + return name and name.rsplit(".")[-1].startswith("$c")
1.31 +
1.32 def get_types(self):
1.33
1.34 "Return class, instance-only and module types for this reference."