Skip to content

Commit

Permalink
python
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Nov 22, 2024
1 parent a32fe03 commit bffb755
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/compiler/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ let generate ctx tctx ext actx =
Genjvm.generate actx.jvm_flag (Common.to_gctx com)
),"jvm"
| Python ->
Genpy.generate,"python"
(fun com ->
Genpy.generate (Common.to_gctx com)
),"python"
| Hl ->
(fun com ->
Genhl.generate (Common.to_gctx com)
Expand Down
18 changes: 8 additions & 10 deletions src/generators/genpy.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open Globals
open Ast
open Error
open Type
open Common
open Gctx
open Texpr.Builder

module Utils = struct
Expand Down Expand Up @@ -1000,12 +1000,12 @@ module Printer = struct
pc_indent : string;
pc_next_anon_func : unit -> string;
pc_debug : bool;
pc_com : Common.context;
pc_com : Gctx.t;
}

let has_feature pctx = Common.has_feature pctx.pc_com
let has_feature pctx = Gctx.has_feature pctx.pc_com

let add_feature pctx = Common.add_feature pctx.pc_com
let add_feature pctx = Gctx.add_feature pctx.pc_com

let create_context =
let n = ref (-1) in
Expand Down Expand Up @@ -1494,9 +1494,7 @@ module Printer = struct
let interpolate () =
Codegen.interpolate_code pctx.pc_com.error code tl (Buffer.add_string buf) (fun e -> Buffer.add_string buf (print_expr pctx e)) ecode.epos
in
let old = pctx.pc_com.error_ext in
pctx.pc_com.error_ext <- (fun err -> raise (Error.Fatal_error err));
Std.finally (fun() -> pctx.pc_com.error_ext <- old) interpolate ();
interpolate ();
Buffer.contents buf
| ("python_Syntax._pythonCode"), [e] ->
print_expr pctx e
Expand Down Expand Up @@ -1674,7 +1672,7 @@ end

module Generator = struct
type context = {
com : Common.context;
com : Gctx.t;
buf : Buffer.t;
packages : (string,int) Hashtbl.t;
mutable static_inits : (unit -> unit) list;
Expand All @@ -1684,8 +1682,8 @@ module Generator = struct
print_time : float;
}

let has_feature ctx = Common.has_feature ctx.com
let add_feature ctx = Common.add_feature ctx.com
let has_feature ctx = Gctx.has_feature ctx.com
let add_feature ctx = Gctx.add_feature ctx.com

type class_field_infos = {
cfd_fields : string list;
Expand Down

0 comments on commit bffb755

Please sign in to comment.