|
@@ -491,6 +491,29 @@ class AnalysisState(object):
|
|
|
tree_ir.DeleteEdgeInstruction(
|
|
|
value_link.create_load())))
|
|
|
|
|
|
+ def analyze_access(self, instruction_id):
|
|
|
+ """Tries to analyze the given 'access' instruction."""
|
|
|
+ var_id, = yield [("RD", [instruction_id, "var"])]
|
|
|
+
|
|
|
+ try:
|
|
|
+ gen = self.analyze(var_id)
|
|
|
+ inp = None
|
|
|
+ while True:
|
|
|
+ inp = yield gen.send(inp)
|
|
|
+ except primitive_functions.PrimitiveFinished as ex:
|
|
|
+ var_r = ex.result
|
|
|
+
|
|
|
+ # Accessing a variable is pretty easy. It really just boils
|
|
|
+ # down to reading the value corresponding to the 'value' key
|
|
|
+ # of the variable.
|
|
|
+ #
|
|
|
+ # value, = yield [("RD", [returnvalue, "value"])]
|
|
|
+
|
|
|
+ raise primitive_functions.PrimitiveFinished(
|
|
|
+ tree_ir.ReadDictionaryValueInstruction(
|
|
|
+ var_r,
|
|
|
+ tree_ir.LiteralInstruction('value')))
|
|
|
+
|
|
|
instruction_analyzers = {
|
|
|
'if' : analyze_if,
|
|
|
'while' : analyze_while,
|
|
@@ -500,6 +523,7 @@ class AnalysisState(object):
|
|
|
'declare' : analyze_declare,
|
|
|
'global' : analyze_global,
|
|
|
'assign' : analyze_assign,
|
|
|
+ 'access' : analyze_access,
|
|
|
'output' : analyze_output
|
|
|
}
|
|
|
|