Skip to content

Commit

Permalink
Merge pull request #511 from hacspec/fix-rust-printer-impls
Browse files Browse the repository at this point in the history
fix(engine/print-rust): `impl ...` local_idents
  • Loading branch information
jschneider-bensch authored Feb 15, 2024
2 parents c87db03 + b8274bd commit bc9793f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion engine/lib/print_rust.ml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ module Raw = struct
let pglobal_ident = pglobal_ident' ""

let plocal_ident span (e : Local_ident.t) : AnnotatedString.t =
pure span e.name
let name =
match String.chop_prefix ~prefix:"impl " e.name with
| Some name ->
"impl_"
^ String.map
~f:(function
| 'a' .. 'z' as letter -> letter
| 'A' .. 'Z' as letter -> letter
| _ -> '_')
name
| _ -> e.name
in
pure span name

let dmutability span : _ -> AnnotatedString.t =
pure span << function Mutable _ -> "mut " | _ -> ""
Expand Down

0 comments on commit bc9793f

Please sign in to comment.