ART: Immutable `variables` dictionary in Checker
Python's lack of read-only references makes passing state information
to other functions unsafe. This patch adds an immutable dictionary
class to Checker and uses it when passing around current values of
variables.
Change-Id: I54f2eac54d4d59e16daa74364e6d91a6cc953f6f
diff --git a/tools/checker/match/file.py b/tools/checker/match/file.py
index 2ed4aa7..116fe9a 100644
--- a/tools/checker/match/file.py
+++ b/tools/checker/match/file.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from common.immutables import ImmutableDict
from common.logger import Logger
from file_format.c1visualizer.struct import C1visualizerFile, C1visualizerPass
from file_format.checker.struct import CheckerFile, TestCase, TestAssertion
@@ -112,7 +113,7 @@
responsible for running the checks in the right order and scope, and
for propagating the variable state between the check lines.
"""
- varState = {}
+ varState = ImmutableDict()
checkLines = checkGroup.assertions
outputLines = outputGroup.body
startLineNo = outputGroup.startLineNo