Created
November 25, 2015 16:42
-
-
Save j0sh/82ef1f9bba60c3bb692f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/ppx/ppx_sqlexpr.ml b/src/ppx/ppx_sqlexpr.ml | |
| index 8fd5763..b13ebbd 100644 | |
| --- a/src/ppx/ppx_sqlexpr.ml | |
| +++ b/src/ppx/ppx_sqlexpr.ml | |
| @@ -13,11 +13,11 @@ let new_id = | |
| sprintf "__ppx_sql_%d" !n | |
| let gen_stmt loc ~cacheable sql inp = | |
| - let mkstr s = Exp.constant (Const_string (s, None)) in | |
| + let mkstr s = Exp.constant ~loc (Const_string (s, None)) in | |
| let mklid s = {txt=Lident s; loc} in | |
| - let mkident s = Exp.ident (mklid s) in | |
| - let mkapply fn args = Exp.apply (mkident fn) args in | |
| - let mkpident txt = Pat.var {txt; loc} in | |
| + let mkident s = Exp.ident ~loc (mklid s) in | |
| + let mkapply fn args = Exp.apply ~loc (mkident fn) args in | |
| + let mkpident txt = Pat.var ~loc {txt; loc} in | |
| let k = new_id () in | |
| let st = new_id () in | |
| @@ -46,23 +46,23 @@ let gen_stmt loc ~cacheable sql inp = | |
| let gen_expr loc ~cacheable sql inp outp = | |
| let mklid s = {txt=Lident s; loc} in | |
| - let mkident s = Exp.ident (mklid s) in | |
| - let mkpident txt = Pat.var {txt; loc} in | |
| - let mkint i = Exp.constant (Const_int i) in | |
| + let mkident s = Exp.ident ~loc (mklid s) in | |
| + let mkpident txt = Pat.var ~loc {txt; loc} in | |
| + let mkint i = Exp.constant ~loc (Const_int i) in | |
| let stmt = gen_stmt loc ~cacheable sql inp in | |
| let id = new_id () in | |
| let conv s = Longident.(Ldot (Ldot (Lident "Sqlexpr", "Conversion"), s)) in | |
| let conv_exprs = List.mapi (fun i elem -> | |
| let txt = conv (Sqlexpr_parser.out_type2str elem) in | |
| - let fn = Exp.ident {txt; loc} in | |
| + let fn = Exp.ident ~loc {txt; loc} in | |
| let args = [("", [%expr Array.get [%e mkident id] [%e mkint i]])] in | |
| - Exp.apply fn args) outp in | |
| + Exp.apply ~loc fn args) outp in | |
| let tuple_func = | |
| let e = match conv_exprs with | |
| [] -> assert false | |
| | [x] -> x | |
| - | hd::tl -> Exp.tuple conv_exprs in | |
| + | hd::tl -> Exp.tuple ~loc conv_exprs in | |
| [%expr fun [%p mkpident id] -> [%e e]] in | |
| [%expr { | |
| Sqlexpr.statement = [%e stmt]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment