Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jscomp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ bin/jsoo_reactjs_jsx_ppx_v2.ml:./bin/reactjs_jsx_ppx_v2.bspp.ml ../lib/bspp.exe
BS_COMPILER_IN_BROWSER=true ../lib/bspp.exe $^ > $@

bin/js_compiler.ml:./bin/bspack.exe
./bin/bspack.exe -D BS_COMPILER_IN_BROWSER=true -U BS_DEBUG -bs-MD -module-alias Config=Config_whole_compiler -bs-exclude-I config -o $@ -bs-main Jsoo_main -I $(OCAML_SRC_UTILS) -I $(OCAML_SRC_PARSING) -I $(OCAML_SRC_TYPING) -I $(OCAML_SRC_BYTECOMP) -I $(OCAML_SRC_DRIVER) -I stubs -I ext -I syntax -I depends -I common -I core -I super_errors -I outcome_printer
./bin/bspack.exe -D BS_COMPILER_IN_BROWSER=true -U BS_DEBUG -bs-MD -module-alias Config=Config_whole_compiler -bs-exclude-I config -o $@ -bs-main Jsoo_main -I $(OCAML_SRC_UTILS) -I $(OCAML_SRC_PARSING) -I $(OCAML_SRC_TYPING) -I $(OCAML_SRC_BYTECOMP) -I $(OCAML_SRC_DRIVER) -I stubs -I ext -I syntax -I depends -I common -I core -I super_errors -I bsb -I outcome_printer

bin/all_ounit_tests.ml:./bin/bspack.exe
$< -bs-MD -I ounit -I ounit_tests -I stubs -I bsb -I common -I ext -I syntax -I depends -I bspp -I core -bs-main Ounit_tests_main -o $@
Expand Down
23 changes: 23 additions & 0 deletions jscomp/bin/js_compiler.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bin/js_compiler.ml : ./core/js_long.ml
bin/js_compiler.ml : ./core/lam_dce.ml
bin/js_compiler.ml : ./ext/ext_char.ml
bin/js_compiler.ml : ./ext/ext_int.mli
bin/js_compiler.ml : ./ext/ext_json.ml
bin/js_compiler.ml : ./ext/ext_list.ml
bin/js_compiler.ml : ./ext/ext_path.ml
bin/js_compiler.ml : ./ext/ext_ref.mli
Expand All @@ -43,6 +44,7 @@ bin/js_compiler.ml : ./ext/ext_array.ml
bin/js_compiler.ml : ./ext/ext_bytes.ml
bin/js_compiler.ml : ./ext/ext_char.mli
bin/js_compiler.ml : ./ext/ext_ident.ml
bin/js_compiler.ml : ./ext/ext_json.mli
bin/js_compiler.ml : ./ext/ext_list.mli
bin/js_compiler.ml : ./ext/ext_path.mli
bin/js_compiler.ml : ./ext/ext_utf8.mli
Expand Down Expand Up @@ -73,6 +75,7 @@ bin/js_compiler.ml : ./ext/ident_set.mli
bin/js_compiler.ml : ./ext/string_map.ml
bin/js_compiler.ml : ./syntax/ast_exp.ml
bin/js_compiler.ml : ./syntax/ast_pat.ml
bin/js_compiler.ml : ./bsb/bsb_warning.ml
bin/js_compiler.ml : ./common/ext_log.mli
bin/js_compiler.ml : ./core/js_closure.ml
bin/js_compiler.ml : ./core/js_fun_env.ml
Expand All @@ -96,6 +99,7 @@ bin/js_compiler.ml : ./syntax/ast_exp.mli
bin/js_compiler.ml : ./syntax/ast_pat.mli
bin/js_compiler.ml : ./syntax/ast_util.ml
bin/js_compiler.ml : ../vendor/ocaml/utils/tbl.ml
bin/js_compiler.ml : ./bsb/bsb_warning.mli
bin/js_compiler.ml : ./common/js_config.ml
bin/js_compiler.ml : ./core/config_util.ml
bin/js_compiler.ml : ./core/js_analyzer.ml
Expand Down Expand Up @@ -127,6 +131,7 @@ bin/js_compiler.ml : ./syntax/ppx_entry.ml
bin/js_compiler.ml : ../vendor/ocaml/typing/env.ml
bin/js_compiler.ml : ../vendor/ocaml/utils/misc.ml
bin/js_compiler.ml : ../vendor/ocaml/utils/tbl.mli
bin/js_compiler.ml : ./bsb/bsb_exception.ml
bin/js_compiler.ml : ./common/bs_version.ml
bin/js_compiler.ml : ./common/js_config.mli
bin/js_compiler.ml : ./core/config_util.mli
Expand Down Expand Up @@ -157,7 +162,9 @@ bin/js_compiler.ml : ./syntax/ast_tdcls.mli
bin/js_compiler.ml : ./syntax/ppx_entry.mli
bin/js_compiler.ml : ../vendor/ocaml/typing/env.mli
bin/js_compiler.ml : ../vendor/ocaml/typing/path.ml
bin/js_compiler.ml : ../vendor/ocaml/utils/ccomp.ml
bin/js_compiler.ml : ../vendor/ocaml/utils/misc.mli
bin/js_compiler.ml : ./bsb/bsb_exception.mli
bin/js_compiler.ml : ./common/bs_version.mli
bin/js_compiler.ml : ./common/bs_warnings.ml
bin/js_compiler.ml : ./core/js_call_info.mli
Expand Down Expand Up @@ -189,6 +196,7 @@ bin/js_compiler.ml : ../vendor/ocaml/typing/mtype.ml
bin/js_compiler.ml : ../vendor/ocaml/typing/path.mli
bin/js_compiler.ml : ../vendor/ocaml/typing/subst.ml
bin/js_compiler.ml : ../vendor/ocaml/typing/types.ml
bin/js_compiler.ml : ../vendor/ocaml/utils/ccomp.mli
bin/js_compiler.ml : ./common/bs_warnings.mli
bin/js_compiler.ml : ./common/lam_methname.ml
bin/js_compiler.ml : ./core/js_cmj_format.mli
Expand All @@ -211,6 +219,7 @@ bin/js_compiler.ml : ./syntax/ast_literal.mli
bin/js_compiler.ml : ./syntax/ast_payload.mli
bin/js_compiler.ml : ./syntax/ast_polyvar.mli
bin/js_compiler.ml : ./syntax/bs_syntaxerr.ml
bin/js_compiler.ml : ../vendor/ocaml/driver/pparse.ml
bin/js_compiler.ml : ../vendor/ocaml/parsing/lexer.ml
bin/js_compiler.ml : ../vendor/ocaml/parsing/parse.ml
bin/js_compiler.ml : ../vendor/ocaml/typing/annot.mli
Expand Down Expand Up @@ -248,6 +257,7 @@ bin/js_compiler.ml : ./syntax/ast_structure.ml
bin/js_compiler.ml : ./syntax/bs_ast_mapper.ml
bin/js_compiler.ml : ./syntax/bs_syntaxerr.mli
bin/js_compiler.ml : ../vendor/ocaml/driver/compenv.ml
bin/js_compiler.ml : ../vendor/ocaml/driver/pparse.mli
bin/js_compiler.ml : ../vendor/ocaml/parsing/lexer.mli
bin/js_compiler.ml : ../vendor/ocaml/parsing/parse.mli
bin/js_compiler.ml : ../vendor/ocaml/parsing/parser.ml
Expand All @@ -258,6 +268,7 @@ bin/js_compiler.ml : ../vendor/ocaml/typing/typemod.ml
bin/js_compiler.ml : ../vendor/ocaml/utils/clflags.mli
bin/js_compiler.ml : ../vendor/ocaml/utils/terminfo.ml
bin/js_compiler.ml : ../vendor/ocaml/utils/warnings.ml
bin/js_compiler.ml : ./bsb/bsb_build_schemas.ml
bin/js_compiler.ml : ./core/js_cmj_datasets.mli
bin/js_compiler.ml : ./core/js_dump_program.mli
bin/js_compiler.ml : ./core/js_dump_property.ml
Expand Down Expand Up @@ -318,6 +329,7 @@ bin/js_compiler.ml : ./core/lam_module_ident.mli
bin/js_compiler.ml : ./core/lam_pass_collect.mli
bin/js_compiler.ml : ./core/lam_pass_lets_dce.ml
bin/js_compiler.ml : ./core/lam_stats_export.mli
bin/js_compiler.ml : ./super_errors/super_env.ml
bin/js_compiler.ml : ./syntax/ast_attributes.mli
bin/js_compiler.ml : ./syntax/ast_derive_util.ml
bin/js_compiler.ml : ./syntax/ast_external_mk.ml
Expand Down Expand Up @@ -346,6 +358,8 @@ bin/js_compiler.ml : ./core/lam_compile_global.ml
bin/js_compiler.ml : ./core/lam_eta_conversion.ml
bin/js_compiler.ml : ./core/lam_pass_lets_dce.mli
bin/js_compiler.ml : ./ext/hash_set_ident_mask.ml
bin/js_compiler.ml : ./super_errors/super_main.ml
bin/js_compiler.ml : ./super_errors/super_misc.ml
bin/js_compiler.ml : ./syntax/ast_derive_util.mli
bin/js_compiler.ml : ./syntax/ast_external_mk.mli
bin/js_compiler.ml : ./syntax/ast_utf8_string.mli
Expand All @@ -370,6 +384,7 @@ bin/js_compiler.ml : ./core/lam_compile_global.mli
bin/js_compiler.ml : ./core/lam_eta_conversion.mli
bin/js_compiler.ml : ./ext/hash_set_ident_mask.mli
bin/js_compiler.ml : ./ext/ordered_hash_map_gen.ml
bin/js_compiler.ml : ./super_errors/super_misc.mli
bin/js_compiler.ml : ./syntax/ast_exp_extension.ml
bin/js_compiler.ml : ./syntax/bs_ast_invariant.mli
bin/js_compiler.ml : ./syntax/external_arg_spec.ml
Expand All @@ -391,6 +406,7 @@ bin/js_compiler.ml : ./core/js_name_of_module_id.ml
bin/js_compiler.ml : ./core/js_of_lam_exception.mli
bin/js_compiler.ml : ./core/lam_beta_reduce_util.ml
bin/js_compiler.ml : ./core/lam_compile_context.mli
bin/js_compiler.ml : ./super_errors/super_pparse.ml
bin/js_compiler.ml : ./syntax/ast_exp_extension.mli
bin/js_compiler.ml : ./syntax/external_arg_spec.mli
bin/js_compiler.ml : ./syntax/external_ffi_types.ml
Expand All @@ -411,6 +427,7 @@ bin/js_compiler.ml : ./core/lam_beta_reduce_util.mli
bin/js_compiler.ml : ./core/lam_compile_primitive.ml
bin/js_compiler.ml : ./core/lam_pass_deep_flatten.ml
bin/js_compiler.ml : ./core/lam_pass_remove_alias.ml
bin/js_compiler.ml : ./super_errors/super_typemod.ml
bin/js_compiler.ml : ./syntax/ast_derive_abstract.ml
bin/js_compiler.ml : ./syntax/external_ffi_types.mli
bin/js_compiler.ml : ../vendor/ocaml/bytecomp/printlambda.ml
Expand All @@ -427,6 +444,10 @@ bin/js_compiler.ml : ./core/lam_dispatch_primitive.ml
bin/js_compiler.ml : ./core/lam_pass_deep_flatten.mli
bin/js_compiler.ml : ./core/lam_pass_eliminate_ref.ml
bin/js_compiler.ml : ./core/lam_pass_remove_alias.mli
bin/js_compiler.ml : ./super_errors/super_location.ml
bin/js_compiler.ml : ./super_errors/super_typecore.ml
bin/js_compiler.ml : ./super_errors/super_typetexp.ml
bin/js_compiler.ml : ./super_errors/super_warnings.ml
bin/js_compiler.ml : ./syntax/ast_derive_abstract.mli
bin/js_compiler.ml : ./syntax/ast_derive_js_mapper.ml
bin/js_compiler.ml : ./syntax/ast_derive_projector.ml
Expand All @@ -448,8 +469,10 @@ bin/js_compiler.ml : ./core/lam_pass_alpha_conversion.ml
bin/js_compiler.ml : ./syntax/ast_utf8_string_interp.mli
bin/js_compiler.ml : ./core/lam_compile_external_call.mli
bin/js_compiler.ml : ./core/lam_pass_alpha_conversion.mli
bin/js_compiler.ml : ./super_errors/super_reason_react.ml
bin/js_compiler.ml : ./syntax/ast_core_type_class_type.ml
bin/js_compiler.ml : ./ext/ordered_hash_map_local_ident.ml
bin/js_compiler.ml : ./super_errors/super_reason_react.mli
bin/js_compiler.ml : ./syntax/ast_core_type_class_type.mli
bin/js_compiler.ml : ./syntax/ast_tuple_pattern_flatten.ml
bin/js_compiler.ml : ./ext/ordered_hash_map_local_ident.mli
Expand Down
2 changes: 1 addition & 1 deletion jscomp/bin/reactjs_jsx_ppx_v2.bspp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ let rewrite code =
with e ->
match Location.error_of_exn e with
| Some error ->
Location.report_error Format.std_formatter error;
Location.report_error Format.err_formatter error;
let (file, line, startchar) = Location.get_pos_info error.loc.loc_start in
let (file, endline, endchar) = Location.get_pos_info error.loc.loc_end in
Js.Unsafe.(obj
Expand Down
4 changes: 3 additions & 1 deletion jscomp/bsb/bsb_warning.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ type t = {
- 48 Implicit elimination of optional arguments. https://caml.inria.fr/mantis/view.php?id=6352
- 101 (bsb-specific) unsafe polymorphic comparison.
*)
let default_warning_flag = "-w -30-40+6+7+27+32..39+44+45+101"
let default_warning = "-30-40+6+7+27+32..39+44+45+101"

let default_warning_flag = "-w " ^ default_warning

let get_warning_flag x =
default_warning_flag ^
Expand Down
9 changes: 6 additions & 3 deletions jscomp/bsb/bsb_warning.mli
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@



type t
type t

val get_warning_flag : t option -> string
val get_warning_flag : t option -> string

val default_warning : string

val default_warning_flag : string
(* default_warning, including the -w prefix, for command-line arguments *)

val from_map : Ext_json_types.t String_map.t -> t option

(** [opt_warning_to_string not_dev warning]
*)
val opt_warning_to_string : bool -> t option -> string
val opt_warning_to_string : bool -> t option -> string

14 changes: 9 additions & 5 deletions jscomp/core/jsoo_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ let implementation ~use_super_errors prefix impl str : Js.Unsafe.obj =
let env = Compmisc.initial_env() in (* Question ?? *)
let finalenv = ref Env.empty in
let types_signature = ref [] in
if use_super_errors then begin
Misc.Color.setup Clflags.Always;
Super_main.setup ();
end;

(* copied over from Bsb_warning.default_warning_flag *)
Warnings.parse_options false Bsb_warning.default_warning;

try
impl (Lexing.from_string
(if prefix then "[@@@bs.config{no_export}]\n#1 \"repl.ml\"\n" ^ str else str ))
Expand All @@ -99,13 +107,9 @@ let implementation ~use_super_errors prefix impl str : Js.Unsafe.obj =
(* Format.fprintf output_ppf {| { "js_code" : %S }|} v ) *)
with
| e ->
if use_super_errors then begin
Misc.Color.setup Clflags.Always;
Super_main.setup ();
end;
begin match Location.error_of_exn e with
| Some error ->
Location.report_error Format.std_formatter error;
Location.report_error Format.err_formatter error;
let (file,line,startchar) = Location.get_pos_info error.loc.loc_start in
let (file,endline,endchar) = Location.get_pos_info error.loc.loc_end in
Js.Unsafe.(obj
Expand Down