Commit 23c2bbf5 authored by Stefan Behnel's avatar Stefan Behnel

minor code cleanups

parent bdc95095
...@@ -157,10 +157,11 @@ def report_error(err): ...@@ -157,10 +157,11 @@ def report_error(err):
try: echo_file.write(line) try: echo_file.write(line)
except UnicodeEncodeError: except UnicodeEncodeError:
echo_file.write(line.encode('ASCII', 'replace')) echo_file.write(line.encode('ASCII', 'replace'))
num_errors = num_errors + 1 num_errors += 1
if Options.fast_fail: if Options.fast_fail:
raise AbortError("fatal errors") raise AbortError("fatal errors")
def error(position, message): def error(position, message):
#print "Errors.error:", repr(position), repr(message) ### #print "Errors.error:", repr(position), repr(message) ###
if position is None: if position is None:
...@@ -170,7 +171,9 @@ def error(position, message): ...@@ -170,7 +171,9 @@ def error(position, message):
report_error(err) report_error(err)
return err return err
LEVEL=1 # warn about all errors level 1 or higher
LEVEL = 1 # warn about all errors level 1 or higher
def message(position, message, level=1): def message(position, message, level=1):
if level < LEVEL: if level < LEVEL:
...@@ -183,6 +186,7 @@ def message(position, message, level=1): ...@@ -183,6 +186,7 @@ def message(position, message, level=1):
echo_file.write(line) echo_file.write(line)
return warn return warn
def warning(position, message, level=0): def warning(position, message, level=0):
if level < LEVEL: if level < LEVEL:
return return
...@@ -196,6 +200,7 @@ def warning(position, message, level=0): ...@@ -196,6 +200,7 @@ def warning(position, message, level=0):
echo_file.write(line) echo_file.write(line)
return warn return warn
_warn_once_seen = {} _warn_once_seen = {}
def warn_once(position, message, level=0): def warn_once(position, message, level=0):
if level < LEVEL or message in _warn_once_seen: if level < LEVEL or message in _warn_once_seen:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment