Skip to content

Commit

Permalink
Add meta information to the trait decls/impls
Browse files Browse the repository at this point in the history
  • Loading branch information
sonmarcho committed Nov 21, 2023
1 parent 49231f3 commit 8fe2147
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charon-ml/src/GAst.ml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ type trait_decl = {
def_id : trait_decl_id;
is_local : bool;
name : name;
meta : meta;
generics : generic_params;
preds : predicates;
parent_clauses : trait_clause list;
Expand All @@ -158,6 +159,7 @@ type trait_impl = {
def_id : trait_impl_id;
is_local : bool;
name : name;
meta : meta;
impl_trait : trait_decl_ref;
generics : generic_params;
preds : predicates;
Expand Down
6 changes: 6 additions & 0 deletions charon-ml/src/GAstOfJson.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@ let trait_decl_of_json (id_to_file : id_to_file_map) (js : json) :
("def_id", def_id);
("is_local", is_local);
("name", name);
("meta", meta);
("generics", generics);
("preds", preds);
("parent_clauses", parent_clauses);
Expand All @@ -1064,6 +1065,7 @@ let trait_decl_of_json (id_to_file : id_to_file_map) (js : json) :
let* def_id = TraitDeclId.id_of_json def_id in
let* is_local = bool_of_json is_local in
let* name = name_of_json id_to_file name in
let* meta = meta_of_json id_to_file meta in
let* generics = generic_params_of_json id_to_file generics in
let* preds = predicates_of_json preds in
let* parent_clauses =
Expand Down Expand Up @@ -1099,6 +1101,7 @@ let trait_decl_of_json (id_to_file : id_to_file_map) (js : json) :
def_id;
is_local;
name;
meta;
generics;
preds;
parent_clauses;
Expand All @@ -1118,6 +1121,7 @@ let trait_impl_of_json (id_to_file : id_to_file_map) (js : json) :
("def_id", def_id);
("is_local", is_local);
("name", name);
("meta", meta);
("impl_trait", impl_trait);
("generics", generics);
("preds", preds);
Expand All @@ -1130,6 +1134,7 @@ let trait_impl_of_json (id_to_file : id_to_file_map) (js : json) :
let* def_id = TraitImplId.id_of_json def_id in
let* is_local = bool_of_json is_local in
let* name = name_of_json id_to_file name in
let* meta = meta_of_json id_to_file meta in
let* impl_trait = trait_decl_ref_of_json impl_trait in
let* generics = generic_params_of_json id_to_file generics in
let* preds = predicates_of_json preds in
Expand Down Expand Up @@ -1158,6 +1163,7 @@ let trait_impl_of_json (id_to_file : id_to_file_map) (js : json) :
def_id;
is_local;
name;
meta;
impl_trait;
generics;
preds;
Expand Down
2 changes: 2 additions & 0 deletions charon/src/gast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ pub struct TraitDecl {
/// an external crate.
pub is_local: bool,
pub name: Name,
pub meta: Meta,
pub generics: GenericParams,
pub preds: Predicates,
/// The "parent" clauses: the supertraits.
Expand Down Expand Up @@ -223,6 +224,7 @@ pub struct TraitImpl {
/// an external crate.
pub is_local: bool,
pub name: Name,
pub meta: Meta,
/// The information about the implemented trait.
/// Note that this contains the instantiation of the "parent"
/// clauses.
Expand Down
2 changes: 2 additions & 0 deletions charon/src/translate_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ impl<'tcx, 'ctx> TransCtx<'tcx, 'ctx> {
def_id,
is_local: rust_id.is_local(),
name,
meta: self.translate_meta_from_rid(rust_id),
generics,
preds,
parent_clauses,
Expand Down Expand Up @@ -597,6 +598,7 @@ impl<'tcx, 'ctx> TransCtx<'tcx, 'ctx> {
def_id,
is_local: rust_id.is_local(),
name,
meta: bt_ctx.t_ctx.translate_meta_from_rid(rust_id),
impl_trait: implemented_trait,
generics: bt_ctx.get_generics(),
preds: bt_ctx.get_predicates(),
Expand Down

0 comments on commit 8fe2147

Please sign in to comment.