mirror of
https://github.com/Nuitka/Nuitka.git
synced 2025-12-14 20:35:49 +01:00
Cleanup, syntax errors always improved.
* Always output the best syntax error format, and do away with compatible syntax errors. Instead make the comparison restricted to the message of error only. * This reduces tedious code and tried to mimic the various Python versions errors for no good reasons.
This commit is contained in:
@@ -28,7 +28,7 @@ from nuitka.utils.InstanceCounters import counted_del, counted_init
|
||||
class SourceCodeReference(object):
|
||||
# TODO: Measure the access speed impact of slots. The memory savings is
|
||||
# not worth it (only a few percent).
|
||||
__slots__ = ["filename", "line", "future_spec", "internal"]
|
||||
__slots__ = ["filename", "line", "column", "future_spec", "internal"]
|
||||
|
||||
@classmethod
|
||||
def fromFilenameAndLine(cls, filename, line, future_spec):
|
||||
@@ -44,8 +44,9 @@ class SourceCodeReference(object):
|
||||
|
||||
@counted_init
|
||||
def __init__(self):
|
||||
self.line = None
|
||||
self.filename = None
|
||||
self.line = None
|
||||
self.column = None
|
||||
self.future_spec = None
|
||||
self.internal = False
|
||||
|
||||
@@ -111,9 +112,22 @@ class SourceCodeReference(object):
|
||||
else:
|
||||
return self
|
||||
|
||||
def atColumnNumber(self, column):
|
||||
assert type(column) is int, column
|
||||
|
||||
if self.column != column:
|
||||
result = self._clone(self.line)
|
||||
result.column = column
|
||||
return result
|
||||
else:
|
||||
return self
|
||||
|
||||
def getLineNumber(self):
|
||||
return self.line
|
||||
|
||||
def getColumnNumber(self):
|
||||
return self.column
|
||||
|
||||
def getFilename(self):
|
||||
return self.filename
|
||||
|
||||
|
||||
Reference in New Issue
Block a user