[racerd] use access expression structure in ownership domain

Summary:
The access path format forced some weird patterns on this code, simplify
using the access expression structure.

Reviewed By: ezgicicek

Differential Revision: D16960660

fbshipit-source-id: e8faf619e
master
Nikos Gorogiannis 5 years ago committed by Facebook Github Bot
parent 5f5b3de91a
commit e49f3f1512

@ -356,21 +356,17 @@ module OwnershipDomain = struct
(* return the first non-Unowned ownership value found when checking progressively shorter (* return the first non-Unowned ownership value found when checking progressively shorter
prefixes of [access_exp] *) prefixes of [access_exp] *)
let rec get_owned access_exp astate = let rec get_owned (access_exp : AccessExpression.t) astate =
let keep_looking (access_exp : AccessExpression.t) astate = match find_opt access_exp astate with
match AccessExpression.truncate access_exp with | Some (OwnershipAbstractValue.OwnedIf _ as v) ->
| Some (prefix_exp, _) ->
get_owned prefix_exp astate
| None ->
OwnershipAbstractValue.Unowned
in
match find access_exp astate with
| OwnershipAbstractValue.OwnedIf _ as v ->
v v
| OwnershipAbstractValue.Unowned -> | _ -> (
keep_looking access_exp astate match access_exp with
| exception Caml.Not_found -> | Base _ ->
keep_looking access_exp astate OwnershipAbstractValue.Unowned
| AddressOf prefix | Dereference prefix | FieldOffset (prefix, _) | ArrayOffset (prefix, _, _)
->
get_owned prefix astate )
let rec ownership_of_expr expr ownership = let rec ownership_of_expr expr ownership =

Loading…
Cancel
Save