Skip to content

Commit

Permalink
cleanup: Remove unused values in Predefined
Browse files Browse the repository at this point in the history
Predefined identifiers, paths, references and exceptions are not used.
  • Loading branch information
Julow committed Jan 23, 2024
1 parent f9ac3b5 commit 6d30b7a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 394 deletions.
156 changes: 0 additions & 156 deletions src/model/predefined.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ let mk_type ?(doc = empty_doc) ?(eq = nullary_equation) ?repr id =
let locs = locations and canonical = None in
{ TypeDecl.id; locs; doc; canonical; equation = eq; representation = repr }

let mk_exn ~args id =
let locs = locations
and doc = empty_doc
and args = TypeDecl.Constructor.Tuple args
and res = None in
{ Exception.id; locs; doc; args; res }

let mk_constr ?(args = TypeDecl.Constructor.Tuple []) id =
{ TypeDecl.Constructor.id; doc = empty_doc; args; res = None }

Expand Down Expand Up @@ -90,118 +83,8 @@ let none_identifier =
let some_identifier =
Mk.constructor (option_identifier, ConstructorName.make_std "Some")

let match_failure_identifier = Mk.core_exception "Match_failure"
let assert_failure_identifier = Mk.core_exception "Assert_failure"
let invalid_argument_identifier = Mk.core_exception "Invalid_argument"
let failure_identifier = Mk.core_exception "Failure"
let not_found_identifier = Mk.core_exception "Not_found"
let out_of_memory_identifier = Mk.core_exception "Out_of_memory"
let stack_overflow_identifier = Mk.core_exception "Stack_overflow"
let sys_error_identifier = Mk.core_exception "Sys_error"
let end_of_file_identifier = Mk.core_exception "End_of_file"
let division_by_zero_identifier = Mk.core_exception "Division_by_zero"
let sys_blocked_io_identifier = Mk.core_exception "Sys_blocked_io"

let undefined_recursive_module_identifier =
Mk.core_exception "Undefined_recursive_module"

let core_exception_identifier = function
| "Match_failure" -> Some match_failure_identifier
| "Out_of_memory" -> Some out_of_memory_identifier
| "Invalid_argument" -> Some invalid_argument_identifier
| "Failure" -> Some failure_identifier
| "Not_found" -> Some not_found_identifier
| "Sys_error" -> Some sys_error_identifier
| "End_of_file" -> Some end_of_file_identifier
| "Division_by_zero" -> Some division_by_zero_identifier
| "Stack_overflow" -> Some stack_overflow_identifier
| "Sys_blocked_io" -> Some sys_blocked_io_identifier
| "Assert_failure" -> Some assert_failure_identifier
| "Undefined_recursive_module" -> Some undefined_recursive_module_identifier
| _ -> None

let core_constructor_identifier = function
| "false" -> Some false_identifier
| "true" -> Some true_identifier
| "()" -> Some void_identifier
| "[]" -> Some nil_identifier
| "([])" -> Some nil_identifier
| "::" -> Some cons_identifier
| "(::)" -> Some cons_identifier
| "None" -> Some none_identifier
| "Some" -> Some some_identifier
| _ -> None

let bool_path = `Resolved (`Identifier bool_identifier)
let int_path = `Resolved (`Identifier int_identifier)
let char_path = `Resolved (`Identifier char_identifier)
let bytes_path = `Resolved (`Identifier bytes_identifier)
let string_path = `Resolved (`Identifier string_identifier)
let float_path = `Resolved (`Identifier float_identifier)
let unit_path = `Resolved (`Identifier unit_identifier)
let exn_path = `Resolved (`Identifier exn_identifier)
let array_path = `Resolved (`Identifier array_identifier)
let list_path = `Resolved (`Identifier list_identifier)
let option_path = `Resolved (`Identifier option_identifier)
let int32_path = `Resolved (`Identifier int32_identifier)
let int64_path = `Resolved (`Identifier int64_identifier)
let nativeint_path = `Resolved (`Identifier nativeint_identifier)
let lazy_t_path = `Resolved (`Identifier lazy_t_identifier)

let extension_constructor_path =
`Resolved (`Identifier extension_constructor_identifier)

let _floatarray_path = `Resolved (`Identifier floatarray_identifier)
let bool_reference = `Resolved (`Identifier bool_identifier)
let int_reference = `Resolved (`Identifier int_identifier)
let char_reference = `Resolved (`Identifier char_identifier)
let bytes_reference = `Resolved (`Identifier bytes_identifier)
let string_reference = `Resolved (`Identifier string_identifier)
let float_reference = `Resolved (`Identifier float_identifier)
let unit_reference = `Resolved (`Identifier unit_identifier)
let exn_reference = `Resolved (`Identifier exn_identifier)
let array_reference = `Resolved (`Identifier array_identifier)
let list_reference = `Resolved (`Identifier list_identifier)
let option_reference = `Resolved (`Identifier option_identifier)
let int32_reference = `Resolved (`Identifier int32_identifier)
let int64_reference = `Resolved (`Identifier int64_identifier)
let nativeint_reference = `Resolved (`Identifier nativeint_identifier)
let lazy_t_reference = `Resolved (`Identifier lazy_t_identifier)

let extension_constructor_reference =
`Resolved (`Identifier extension_constructor_identifier)

let _floatarray_reference = `Resolved (`Identifier floatarray_identifier)
let false_reference = `Resolved (`Identifier false_identifier)
let true_reference = `Resolved (`Identifier true_identifier)
let void_reference = `Resolved (`Identifier void_identifier)
let nil_reference = `Resolved (`Identifier nil_identifier)
let cons_reference = `Resolved (`Identifier cons_identifier)
let none_reference = `Resolved (`Identifier none_identifier)
let some_reference = `Resolved (`Identifier some_identifier)
let match_failure_reference = `Resolved (`Identifier match_failure_identifier)
let assert_failure_reference = `Resolved (`Identifier assert_failure_identifier)

let invalid_argument_reference =
`Resolved (`Identifier invalid_argument_identifier)

let failure_reference = `Resolved (`Identifier failure_identifier)
let not_found_reference = `Resolved (`Identifier not_found_identifier)
let out_of_memory_reference = `Resolved (`Identifier out_of_memory_identifier)
let stack_overflow_reference = `Resolved (`Identifier stack_overflow_identifier)
let sys_error_reference = `Resolved (`Identifier sys_error_identifier)
let end_of_file_reference = `Resolved (`Identifier end_of_file_identifier)

let division_by_zero_reference =
`Resolved (`Identifier division_by_zero_identifier)

let sys_blocked_io_reference = `Resolved (`Identifier sys_blocked_io_identifier)

let undefined_recursive_module_reference =
`Resolved (`Identifier undefined_recursive_module_identifier)

let string_expr = TypeExpr.Constr (string_path, [])
let int_expr = TypeExpr.Constr (int_path, [])

let false_decl = mk_constr ~args:(Tuple []) false_identifier
let true_decl = mk_constr ~args:(Tuple []) true_identifier
Expand Down Expand Up @@ -269,29 +152,6 @@ let floatarray_decl =
in
mk_type ~doc ~eq:covariant_equation floatarray_identifier

let match_failure_decl =
mk_exn
~args:[ TypeExpr.Tuple [ string_expr; int_expr; int_expr ] ]
match_failure_identifier
let assert_failure_decl =
mk_exn
~args:[ TypeExpr.Tuple [ string_expr; int_expr; int_expr ] ]
assert_failure_identifier
let invalid_argument_decl =
mk_exn ~args:[ string_expr ] invalid_argument_identifier
let failure_decl = mk_exn ~args:[ string_expr ] failure_identifier
let not_found_decl = mk_exn ~args:[] not_found_identifier
let out_of_memory_decl = mk_exn ~args:[] out_of_memory_identifier
let stack_overflow_decl = mk_exn ~args:[] stack_overflow_identifier
let sys_error_decl = mk_exn ~args:[ string_expr ] sys_error_identifier
let end_of_file_decl = mk_exn ~args:[] end_of_file_identifier
let division_by_zero_decl = mk_exn ~args:[] division_by_zero_identifier
let sys_blocked_io_decl = mk_exn ~args:[] sys_blocked_io_identifier
let undefined_recursive_module_decl =
mk_exn
~args:[ TypeExpr.Tuple [ string_expr; int_expr; int_expr ] ]
undefined_recursive_module_identifier

let core_types =
[
int_decl;
Expand All @@ -312,19 +172,3 @@ let core_types =
extension_constructor_decl;
floatarray_decl;
]

let core_exceptions =
[
match_failure_decl;
assert_failure_decl;
invalid_argument_decl;
failure_decl;
not_found_decl;
out_of_memory_decl;
stack_overflow_decl;
sys_error_decl;
end_of_file_decl;
division_by_zero_decl;
sys_blocked_io_decl;
undefined_recursive_module_decl;
]
Loading

0 comments on commit 6d30b7a

Please sign in to comment.