Add `ir_data_utils.reader`
This adds an `ir_data_utils.reader` wrapper that will be used to
access potentially unset chains of fields in an `ir_data` instance. For
now this is simply an annotation that marks sites that are accessing
missing fields.
Part of #118.
diff --git a/compiler/front_end/attribute_checker.py b/compiler/front_end/attribute_checker.py
index 6735075..d8c637c 100644
--- a/compiler/front_end/attribute_checker.py
+++ b/compiler/front_end/attribute_checker.py
@@ -25,6 +25,7 @@
from compiler.util import attribute_util
from compiler.util import error
from compiler.util import ir_data
+from compiler.util import ir_data_utils
from compiler.util import ir_util
from compiler.util import traverse_ir
@@ -433,7 +434,7 @@
def _verify_back_end_attributes(attribute, expected_back_ends, source_file_name,
ir, errors):
- back_end_text = attribute.back_end.text
+ back_end_text = ir_data_utils.reader(attribute).back_end.text
if back_end_text not in expected_back_ends:
expected_back_ends_for_error = expected_back_ends - {""}
errors.append([error.error(