2 * Copyright (c) 2017, Facebook, Inc.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
12 hhas_adata
: Hhas_adata.t list
;
13 hhas_fun
: Hhas_function.t list
;
14 hhas_classes
: Hhas_class.t list
;
15 hhas_typedefs
: Hhas_typedef.t list
;
16 hhas_main
: Hhas_body.t
;
19 let make hhas_adata hhas_fun hhas_classes hhas_typedefs hhas_main
=
20 { hhas_adata
; hhas_fun
; hhas_classes
; hhas_typedefs
; hhas_main
}
22 let functions hhas_prog
=
25 let classes hhas_prog
=
26 hhas_prog
.hhas_classes
28 let typedefs hhas_prog
=
29 hhas_prog
.hhas_typedefs
37 open Instruction_sequence
40 let body, _is_generator
, _is_pair_generator
=
42 ~namespace
:Namespace_env.empty_with_default_popt
43 ~is_closure_body
:false
46 ~is_return_by_ref
:false
47 ~scope
:Ast_scope.Scope.toplevel
48 ~return_value
:(instr_int
1)
49 ~default_dropthrough
:None
57 let closed_ast = convert_toplevel_prog ast
in
59 let compiled_defs = emit_main closed_ast in
60 let compiled_funs = Emit_function.emit_functions_from_program
closed_ast in
61 let compiled_classes = Emit_class.emit_classes_from_program
closed_ast in
62 let compiled_typedefs = Emit_typedef.emit_typedefs_from_program
closed_ast in
63 let adata = Emit_adata.get_adata
() in
64 make adata compiled_funs compiled_classes compiled_typedefs compiled_defs
65 with Emit_fatal.IncludeTimeFatalException
(op
, message
) ->
66 let body = Emit_body.make_body
(Emit_fatal.emit_fatal op message
)
68 false (*is_memoize_wrapper*)
70 None
(* return_type_info *)