Cleanup leftover commented code bits

This commit is contained in:
Louis Gesbert 2024-07-05 18:05:57 +02:00
parent ec6b50988b
commit 7e97c19901
5 changed files with 2 additions and 41 deletions

View File

@ -409,21 +409,6 @@ let rec format_expr (ctx : decl_ctx) (fmt : Format.formatter) (e : 'm expr) :
format_with_parens arg1
| EAppOp { op = Log _, _; args = [arg1]; _ } ->
Format.fprintf fmt "%a" format_with_parens arg1
(* | EAppOp
* {
* op = (HandleDefaultOpt as op), _;
* args = (EArray excs, _) :: _ as args;
* _;
* } ->
* let pos = List.map Expr.pos excs in
* Format.fprintf fmt "@[<hov 2>%s@ [|%a|]@ %a@]"
* (Print.operator_to_string op)
* (Format.pp_print_list
* ~pp_sep:(fun ppf () -> Format.fprintf ppf ";@ ")
* format_pos)
* pos
* (Format.pp_print_list ~pp_sep:Format.pp_print_space format_with_parens)
* args *)
| EApp { f; args; _ } ->
Format.fprintf fmt "@[<hov 2>%a@ %a@]" format_with_parens f
(Format.pp_print_list

View File

@ -131,15 +131,6 @@ and translate_expr (ctxt : 'm ctxt) (expr : 'm L.expr) : RevBlock.t * A.expr =
| ETupleAccess { e = e1; index; _ } ->
let e1_stmts, new_e1 = translate_expr ctxt e1 in
e1_stmts, (A.ETupleAccess { e1 = new_e1; index }, Expr.pos expr)
(* | EAppOp
* {
* op = Op.HandleDefaultOpt, _;
* args = [_exceptions; _just; _cons];
* tys = _;
* }
* when ctxt.config.keep_special_ops ->
* (\* This should be translated as a statement *\)
* raise (NotAnExpr { needs_a_local_decl = true }) *)
| EAppOp { op; args; tys = _ } ->
let args_stmts, new_args = translate_expr_list ctxt args in
(* FIXME: what happens if [arg] is not a tuple but reduces to one ? *)

View File

@ -367,8 +367,6 @@ let rec format_expression (ctx : decl_ctx) (fmt : Format.formatter) (e : expr) :
Format.fprintf fmt "%a %a" format_op op (format_expression ctx) arg1
| EAppOp { op; args = [arg1] } ->
Format.fprintf fmt "%a(%a)" format_op op (format_expression ctx) arg1
(* | EAppOp { op = HandleDefaultOpt, _; args = _ } ->
* failwith "should not happen because of keep_special_ops" *)
| EApp { f; args } ->
Format.fprintf fmt "%a(@[<hov 0>%a)@]" (format_expression ctx) f
(Format.pp_print_list

View File

@ -348,18 +348,6 @@ let rec format_expression ctx (fmt : Format.formatter) (e : expr) : unit =
Format.fprintf fmt "%a %a" format_op op (format_expression ctx) arg1
| EAppOp { op; args = [arg1] } ->
Format.fprintf fmt "%a(%a)" format_op op (format_expression ctx) arg1
(* | EAppOp { op = ((HandleDefaultOpt), _) as op; args } ->
* let pos = Mark.get e in
* Format.fprintf fmt
* "%a(@[<hov 0>SourcePosition(filename=\"%s\",@ start_line=%d,@ \
* start_column=%d,@ end_line=%d, end_column=%d,@ law_headings=%a), %a)@]"
* format_op op (Pos.get_file pos) (Pos.get_start_line pos)
* (Pos.get_start_column pos) (Pos.get_end_line pos) (Pos.get_end_column pos)
* format_string_list (Pos.get_law_info pos)
* (Format.pp_print_list
* ~pp_sep:(fun fmt () -> Format.fprintf fmt ",@ ")
* (format_expression ctx))
* args *)
| EApp { f = EFunc x, _; args = [(EArray el, _)] as args }
when Ast.FuncName.compare x Ast.handle_exceptions = 0 ->
Format.fprintf fmt "%a([%a], %a)@]" format_func_name x

View File

@ -608,8 +608,7 @@ def list_length(l: List[Alpha]) -> Integer:
def handle_exceptions(
pos: List[SourcePosition],
exceptions: List[Optional[Alpha]])
-> Optional[Alpha]:
exceptions: List[Optional[Alpha]]) -> Optional[Alpha]:
acc: Optional[Alpha] = None
acc_pos: Optional[pos] = None
for exception, pos in zip(exceptions, pos):
@ -618,7 +617,7 @@ def handle_exceptions(
elif acc is None:
acc = exception
acc_pos = pos
else
else:
raise Conflict(acc_pos,pos)
return acc