File tree Expand file tree Collapse file tree 3 files changed +41
-5
lines changed
Expand file tree Collapse file tree 3 files changed +41
-5
lines changed Original file line number Diff line number Diff line change 11(library
22 (name ppx_metaquot_test)
3+ (modules test_ppx_metaquot)
34 (libraries ppx)
45 (preprocess (pps ppx.metaquot)))
56
67(alias
78 (name runtest)
89 (deps (alias check)))
10+
11+ (alias
12+ (name runtest)
13+ (deps
14+ (:test test.ml)
15+ (package ppx))
16+ (action (chdir %{project_root}
17+ (progn
18+ (ignore-outputs
19+ (run expect-test %{test}))
20+ (diff? %{test} %{test}.corrected)))))
Original file line number Diff line number Diff line change 1+ #require " astlib"
2+ #require " ppx.ast"
3+
4+ let loc = Astlib.Location. none
5+ let () = Clflags. dump_source := true
6+ [%% expect{|
7+ val loc : Astlib.Location .t = < abstr>
8+ |}]
9+
10+
11+ [% expr 42 ]
12+ [%% expect{|
13+
14+ ;;Ppx_ast.V4_07.Expression. create
15+ ~pexp_desc: (Ppx_ast.V4_07.Expression_desc. pexp_constant
16+ (Ppx_ast.V4_07.Constant. pconst_integer " 42" None ))
17+ ~pexp_loc: loc ~pexp_attributes: (Ppx_ast.V4_07.Attributes. create [] );;
18+ - : Ppx_ast.V4_07.Expression. t = < abstr>
19+ | }]
Original file line number Diff line number Diff line change @@ -132,11 +132,16 @@ let main () =
132132 let lexbuf = Lexing. from_string s in
133133 lexbuf.lex_curr_p < - { pos with pos_lnum = 1 ; };
134134 let phrases = ! Toploop. parse_use_file lexbuf in
135- List. iter phrases ~f: (fun phr ->
136- try
137- ignore (Toploop. execute_phrase true ppf (apply_rewriters phr) : bool )
138- with exn ->
139- Location. report_exception ppf exn
135+ List. iter phrases ~f: (function
136+ | Parsetree. Ptop_def [] -> ()
137+ | phr ->
138+ try
139+ let phr = apply_rewriters phr in
140+ if ! Clflags. dump_source then
141+ Format. fprintf ppf " %a@?" Pprintast. top_phrase phr;
142+ ignore (Toploop. execute_phrase true ppf phr : bool )
143+ with exn ->
144+ Location. report_exception ppf exn
140145 );
141146 Format. fprintf ppf " @?|}]@." );
142147 Buffer. contents buf)
You can’t perform that action at this time.
0 commit comments