1.1 --- a/lplc Thu Sep 08 18:34:23 2016 +0200
1.2 +++ b/lplc Thu Sep 08 18:39:38 2016 +0200
1.3 @@ -18,6 +18,12 @@
1.4 return i.load_from_file(path, module_name)
1.5 return None
1.6
1.7 +def show_missing(missing):
1.8 + missing = list(missing)
1.9 + missing.sort()
1.10 + for module_name, name in missing:
1.11 + print >>sys.stderr, "Module %s references an unknown object: %s" % (module_name, name)
1.12 +
1.13 def stopwatch(activity, now):
1.14 print >>sys.stderr, "%s took %.2f seconds" % (activity, time() - now)
1.15 return time()
1.16 @@ -41,10 +47,19 @@
1.17
1.18 i = importer.Importer(path, "_cache", verbose)
1.19 m = i.initialise(filename, reset)
1.20 - i.finalise()
1.21 + success = i.finalise()
1.22
1.23 now = stopwatch("Inspection", now)
1.24
1.25 + # Check for success, indicating missing references otherwise.
1.26 +
1.27 + if not success:
1.28 + show_missing(i.missing)
1.29 + if "-exit" in args:
1.30 + sys.exit(1)
1.31 + else:
1.32 + sys.exit(0)
1.33 +
1.34 # Report any errors.
1.35
1.36 except ProcessingError, exc: