Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix name clashes in code generation.

  • Loading branch information...
commit 740bec050b50bb14ece9eeab320ff42d582a64d4 1 parent eaa7ddb
@samoht authored
Showing with 9 additions and 5 deletions.
  1. +1 −0  lib_test/test.ml
  2. +8 −5 pa_lib/pa_htcaml.ml
View
1  lib_test/test.ml
@@ -43,6 +43,7 @@ let page = <:html<
<body>
$html_of_body b1$
$html_of_link l1$
+ $str:"<b>test</b>"$
$list:[title; body]$
<br/>
<div $alist:tag1$ $attrs:tag2$>tag</div>
View
13 pa_lib/pa_htcaml.ml
@@ -29,25 +29,28 @@ let new_id _loc _ =
;;
let create_class _loc n body =
+ let pid, eid = new_id _loc () in
let tag = <:expr<
((("","div"), [(("","class"), $`str:n$)])
: Xmlm.tag) >> in
<:expr<
match $body$ with [
[] -> []
- | body -> [`El $tag$ body]
+ | $pid$ -> [`El $tag$ $eid$ ]
] >>
let create_id_class _loc n id body =
+ let pid, eid = new_id _loc () in
+ let fn_pid, fn_eid = new_id _loc () in
let tag = <:expr<
- ((("","div"), [(("","id"), html_id); (("","class"), $`str:n$)]) : Xmlm.tag) >> in
+ ((("","div"), [(("","id"), $fn_eid$); (("","class"), $`str:n$)]) : Xmlm.tag) >> in
<:expr<
match $body$ with [
[] -> []
- | body ->
+ | $pid$ ->
match id with [
- None -> $create_class _loc n <:expr< body >>$
- | Some html_id -> [ `El $tag$ $body$ ]
+ None -> $create_class _loc n <:expr< $eid$ >>$
+ | Some $fn_pid$ -> [ `El $tag$ $body$ ]
]
] >>
Please sign in to comment.
Something went wrong with that request. Please try again.