diff options
author | Son Ho | 2021-12-07 16:40:07 +0100 |
---|---|---|
committer | Son Ho | 2021-12-07 16:40:07 +0100 |
commit | 0cc2b46af26d371b6f2f90529d369682f91a7a2e (patch) | |
tree | 4679e40fa66bacc59b3a8fb590b09403714098aa /src | |
parent | 1fca20c26c9d1eb391bcf9c2dd8647ebeb9e4d12 (diff) |
Implement the visitor iter_frame_concrete
Diffstat (limited to '')
-rw-r--r-- | src/Contexts.ml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Contexts.ml b/src/Contexts.ml index 1adb1a02..9bcaaa43 100644 --- a/src/Contexts.ml +++ b/src/Contexts.ml @@ -1,6 +1,7 @@ open Types open Values open CfimAst +module V = Values type binder = { index : VarId.id; (** Unique variable identifier *) @@ -146,3 +147,22 @@ let ctx_push_uninitialized_var (ctx : eval_ctx) (var : var) : eval_ctx = let ctx_push_uninitialized_vars (ctx : eval_ctx) (vars : var list) : eval_ctx = let vars = List.map (fun v -> (v, mk_bottom v.var_ty)) vars in ctx_push_vars ctx vars + +(** Visitor to iterate over the values in a frame. *) +class ['self] iter_frame_concrete = + object (self : 'self) + inherit [_] V.iter_typed_value + + method visit_env_value_Var : 'acc -> binder -> typed_value -> unit = + fun acc vid v -> self#visit_typed_value acc v + + method visit_env : 'acc -> env -> unit = + fun acc env -> + match env with + | [] -> () + | Var (vid, v) :: env -> + self#visit_env_value_Var acc vid v; + self#visit_env acc env + | Abs _ :: _ -> raise Errors.Unimplemented (* TODO *) + | Frame :: _ -> (* We stop here *) () + end |