Skip to content

Commit

Permalink
Trivial improvements to the name generation
Browse files Browse the repository at this point in the history
  • Loading branch information
modlfo committed Jul 14, 2020
1 parent 46a4787 commit e6c9df5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/generators/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ let makeParams (args : args) (params : params) (used : used_function Maps.IdMap.
{ repl = params.repl
; code = args.code
; cleanup = args.roots <> []
; functions = NameTable.make ()
; variables = NameTable.make ()
; functions = NameTable.make 0
; variables = NameTable.make 1
; shorten = args.shorten
; used
}
Expand Down
2 changes: 1 addition & 1 deletion src/generators/progToCode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ let isRoot used =
| _ -> false


let refreshTable (p : parameters) = { p with variables = NameTable.make () }
let refreshTable (p : parameters) = { p with variables = NameTable.make 1 }

let rec convertStmt (p : parameters) (s : stmt) : cstmt =
match s with
Expand Down
2 changes: 1 addition & 1 deletion src/util/nameTable.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type t =
; table : (string, string) Hashtbl.t
}

let make () = { n = Random.State.make [| 0 |]; table = Hashtbl.create 128 }
let make seed = { n = Random.State.make [| seed |]; table = Hashtbl.create 128 }

let generateChar t _ =
let base = if Random.State.bool t.n then 97 else 65 in
Expand Down
2 changes: 1 addition & 1 deletion src/version.ml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
let version = "\nv0.4.10\n"
let version = "\nv0.4.11\n"

0 comments on commit e6c9df5

Please sign in to comment.