Update if sequence in _check_all_source_locations
We can simplify the if flow in `_check_all_source_locations` by checking
if the field is a dataclass first.
diff --git a/compiler/front_end/module_ir_test.py b/compiler/front_end/module_ir_test.py
index dba5523..4eac8f1 100644
--- a/compiler/front_end/module_ir_test.py
+++ b/compiler/front_end/module_ir_test.py
@@ -4103,16 +4103,15 @@
if not proto.HasField(name):
continue
field_path = "{}{}".format(path, name)
- if spec.is_sequence:
- if spec.is_dataclass:
+ if spec.is_dataclass:
+ if spec.is_sequence:
index = 0
for i in getattr(proto, name):
item_path = "{}[{}]".format(field_path, index)
index += 1
errors.extend(
_check_all_source_locations(i, item_path, child_start, child_end))
- else:
- if spec.is_dataclass:
+ else:
errors.extend(_check_all_source_locations(getattr(proto, name),
field_path, child_start,
child_end))