1.1 --- a/inspector.py Tue Oct 25 22:26:03 2016 +0200
1.2 +++ b/inspector.py Tue Oct 25 23:06:37 2016 +0200
1.3 @@ -126,12 +126,20 @@
1.4 in_function = self.function_locals.has_key(path)
1.5
1.6 for name in names:
1.7 - if name in predefined_constants or in_function and name in self.function_locals[path]:
1.8 + if in_function and name in self.function_locals[path]:
1.9 + continue
1.10 +
1.11 + key = "%s.%s" % (path, name)
1.12 +
1.13 + # Find predefined constant names before anything else.
1.14 +
1.15 + if name in predefined_constants:
1.16 + ref = self.get_builtin(name)
1.17 + self.set_name_reference(key, ref)
1.18 continue
1.19
1.20 # Find local definitions (within dynamic namespaces).
1.21
1.22 - key = "%s.%s" % (path, name)
1.23 ref = self.get_resolved_object(key)
1.24 if ref:
1.25 self.set_name_reference(key, ref)
2.1 --- a/lib/__builtins__/__init__.py Tue Oct 25 22:26:03 2016 +0200
2.2 +++ b/lib/__builtins__/__init__.py Tue Oct 25 23:06:37 2016 +0200
2.3 @@ -73,7 +73,7 @@
2.4
2.5 # Classes.
2.6
2.7 -from __builtins__.bool import bool
2.8 +from __builtins__.bool import bool, False, True
2.9 from __builtins__.buffer import buffer
2.10 from __builtins__.complex import complex
2.11 from __builtins__.dict import dict
2.12 @@ -84,8 +84,8 @@
2.13 from __builtins__.iterator import listiterator
2.14 from __builtins__.list import list
2.15 from __builtins__.long import long
2.16 -from __builtins__.none import NoneType
2.17 -from __builtins__.notimplemented import NotImplementedType
2.18 +from __builtins__.none import None, NoneType
2.19 +from __builtins__.notimplemented import NotImplemented, NotImplementedType
2.20 from __builtins__.set import frozenset, set
2.21 from __builtins__.str import basestring, str, unicode
2.22 from __builtins__.tuple import tuple
3.1 --- a/lib/__builtins__/bool.py Tue Oct 25 22:26:03 2016 +0200
3.2 +++ b/lib/__builtins__/bool.py Tue Oct 25 23:06:37 2016 +0200
3.3 @@ -3,7 +3,7 @@
3.4 """
3.5 Boolean objects.
3.6
3.7 -Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
3.8 +Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
3.9
3.10 This program is free software; you can redistribute it and/or modify it under
3.11 the terms of the GNU General Public License as published by the Free Software
3.12 @@ -26,4 +26,7 @@
3.13 def __str__(self):
3.14 return self is True and "True" or "False"
3.15
3.16 +False = bool()
3.17 +True = bool()
3.18 +
3.19 # vim: tabstop=4 expandtab shiftwidth=4
4.1 --- a/lib/__builtins__/float.py Tue Oct 25 22:26:03 2016 +0200
4.2 +++ b/lib/__builtins__/float.py Tue Oct 25 23:06:37 2016 +0200
4.3 @@ -22,7 +22,7 @@
4.4 class float(object):
4.5 def __init__(self, number_or_string=None):
4.6 # Note member.
4.7 - self.data = 0
4.8 + self.__data__ = 0.0
4.9
4.10 def __iadd__(self, other): pass
4.11 def __isub__(self, other): pass
5.1 --- a/lib/__builtins__/int.py Tue Oct 25 22:26:03 2016 +0200
5.2 +++ b/lib/__builtins__/int.py Tue Oct 25 23:06:37 2016 +0200
5.3 @@ -25,7 +25,7 @@
5.4 class int(object):
5.5 def __init__(self, number_or_string=None):
5.6 # Note member.
5.7 - self.data = 0
5.8 + self.__data__ = 0
5.9
5.10 def __iadd__(self, other):
5.11 "Return a new int for the operation."
6.1 --- a/lib/__builtins__/none.py Tue Oct 25 22:26:03 2016 +0200
6.2 +++ b/lib/__builtins__/none.py Tue Oct 25 23:06:37 2016 +0200
6.3 @@ -3,7 +3,7 @@
6.4 """
6.5 None objects.
6.6
6.7 -Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
6.8 +Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
6.9
6.10 This program is free software; you can redistribute it and/or modify it under
6.11 the terms of the GNU General Public License as published by the Free Software
6.12 @@ -24,4 +24,6 @@
6.13 "None is always false."
6.14 return False
6.15
6.16 +None = NoneType()
6.17 +
6.18 # vim: tabstop=4 expandtab shiftwidth=4
7.1 --- a/lib/__builtins__/notimplemented.py Tue Oct 25 22:26:03 2016 +0200
7.2 +++ b/lib/__builtins__/notimplemented.py Tue Oct 25 23:06:37 2016 +0200
7.3 @@ -3,7 +3,7 @@
7.4 """
7.5 Not implemented object.
7.6
7.7 -Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
7.8 +Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
7.9
7.10 This program is free software; you can redistribute it and/or modify it under
7.11 the terms of the GNU General Public License as published by the Free Software
7.12 @@ -21,4 +21,6 @@
7.13
7.14 class NotImplementedType: pass
7.15
7.16 +NotImplemented = NotImplementedType()
7.17 +
7.18 # vim: tabstop=4 expandtab shiftwidth=4
8.1 --- a/lib/__builtins__/str.py Tue Oct 25 22:26:03 2016 +0200
8.2 +++ b/lib/__builtins__/str.py Tue Oct 25 23:06:37 2016 +0200
8.3 @@ -26,7 +26,7 @@
8.4 class basestring(object):
8.5 def __init__(self, data=None):
8.6 # Note member.
8.7 - self.data = data
8.8 + self.__data__ = ""
8.9
8.10 def __contains__(self, value): pass
8.11
9.1 --- a/resolving.py Tue Oct 25 22:26:03 2016 +0200
9.2 +++ b/resolving.py Tue Oct 25 23:06:37 2016 +0200
9.3 @@ -19,7 +19,7 @@
9.4 this program. If not, see <http://www.gnu.org/licenses/>.
9.5 """
9.6
9.7 -from common import init_item, predefined_constants
9.8 +from common import init_item
9.9 from results import AccessRef, InstanceRef, InvocationRef, LocalNameRef, \
9.10 NameRef, ResolvedNameRef
9.11 from referencing import Reference