Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

codemap: git grep now works again. When clicking Top the dw_stack

was getting empty which was then causing git grep to not find the
root (it was using Common.last on dw_stack).
  • Loading branch information...
commit 16ee6f10c50bc8ac8e158920997cbb42b979906f 1 parent 2937a89
@aryx aryx authored
View
4 Makefile
@@ -596,10 +596,10 @@ website:
tags:
./stags -verbose -lang ml .
db:
- ./pfff_db -verbose -lang ml -o DB_LIGHT .
+ ./pfff_db -verbose -lang ml -o DB_LIGHT.marshall .
visual:
./codemap -profile -ss 2 \
- -with_info DB_LIGHT -ocaml_filter .
+ -with_info DB_LIGHT.marshall -ocaml_filter .
test:
./pfff_test all
push:
View
18 commons/common.ml
@@ -83,7 +83,11 @@ let exclude p xs =
List.filter (fun x -> not (p x)) xs
let last_n n l = List.rev (take n (List.rev l))
-let last l = List.hd (last_n 1 l)
+(*let last l = List.hd (last_n 1 l) *)
+let rec list_last = function
+ | [] -> raise Not_found
+ | [x] -> x
+ | x::y::xs -> list_last (y::xs)
let (list_of_string: string -> char list) = function
@@ -2745,7 +2749,7 @@ let first_day_in_week_of_day day =
List.hd (days_in_week_of_day day)
let last_day_in_week_of_day day =
- last (days_in_week_of_day day)
+ list_last (days_in_week_of_day day)
(* ---------------------------------------------------------------------- *)
@@ -3952,10 +3956,12 @@ let rec list_init = function
| [x] -> []
| x::y::xs -> x::(list_init (y::xs))
-let rec list_last = function
- | [] -> raise Not_found
- | [x] -> x
- | x::y::xs -> list_last (y::xs)
+(* now in prelude:
+ * let rec list_last = function
+ * | [] -> raise Not_found
+ * | [x] -> x
+ * | x::y::xs -> list_last (y::xs)
+ *)
(* pixel *)
(* now in prelude
View
3  commons/common.mli
@@ -1355,9 +1355,8 @@ val cons : 'a -> 'a list -> 'a list
val uncons : 'a list -> 'a * 'a list
val safe_tl : 'a list -> 'a list
val head_middle_tail : 'a list -> 'a * 'a list * 'a
-val last : 'a list -> 'a
-val list_init : 'a list -> 'a list
val list_last : 'a list -> 'a
+val list_init : 'a list -> 'a list
val removelast : 'a list -> 'a list
val inits : 'a list -> 'a list list
View
2  h_version-control/git.ml
@@ -255,7 +255,7 @@ let commit_of_relative_time ~basedir relative_data_string =
relative_data_string
)) in
let xs = Common.cmd_to_list cmd in
- let last = Common.last xs in
+ let last = Common.list_last xs in
id_and_summary_oneline last +> fst
let commit_info ~basedir vid =
View
2  lang_cpp/parsing/parsing_hacks.ml
@@ -1533,7 +1533,7 @@ let rec find_macro_lineparen xs =
then begin
msg_macro_toplevel_noptvirg s;
(* just to avoid the end-of-stream pb of ocamlyacc *)
- let tcpar = Common.last info_parens in
+ let tcpar = Common.list_last info_parens in
tcpar.tok <- TCParEOL (TH.info_of_tok tcpar.tok);
(*macro.tok <- TMacroTop (s, TH.info_of_tok macro.tok);*)
View
2  lang_java/analyze/highlight_java.ml
@@ -72,7 +72,7 @@ let visit_toplevel
match name with
| [] -> pr2 "tag_name: noii"
| _ ->
- let before, final = Common.list_init name, Common.last name
+ let before, final = Common.list_init name, Common.list_last name
in
tag_ident final categ
in
View
2  lang_java/parsing/parse_java.ml
@@ -88,7 +88,7 @@ let rec distribute_info_items_toplevel2 xs toks filename =
in
*)
let toks_before_max = Common.list_init toks in
- let toks_after = [Common.last toks] in
+ let toks_after = [Common.list_last toks] in
let info_item = Parse_info.mk_info_item
~info_of_tok:TH.info_of_tok
View
4 lang_php/parsing/pp_php.ml
@@ -146,7 +146,7 @@ let merge_tokens_line ~orig_toks ~pp_toks =
if null commented_a
then failwith "WEIRD: a XHP line has tokens but not the original one";
- let last_orig_info = Common.last commented_a |> TH.info_of_tok in
+ let last_orig_info = Common.list_last commented_a |> TH.info_of_tok in
let last_orig_parse_info = Ast.parse_info_of_info last_orig_info in
let expanded_b = mark_as_expanded last_orig_parse_info b in
@@ -201,7 +201,7 @@ let zip_and_sync ~toks_orig_lines ~toks_pp_lines =
| (((xline, xtoks)::xs) as a), (((yline, ytoks)::ys) as b) ->
- last_orig_tok := Common.last xtoks;
+ last_orig_tok := Common.list_last xtoks;
(match xline <=> yline with
| Inf ->
(* Sometimes XHP just remove certain tokens, like
View
2  main_spatch.ml
@@ -269,7 +269,7 @@ let parse_spatch file =
()
| Some (Plus toadd) ->
(* todo? what if there is no token on this line ? *)
- let last_tok = Common.last toks_at_line in
+ let last_tok = Common.list_last toks_at_line in
(match last_tok.transfo with
| Remove -> last_tok.transfo <- Replace (AddStr toadd)
| NoTransfo -> last_tok.transfo <- AddAfter (AddStr toadd)
View
6 visual/view2.ml
@@ -64,7 +64,7 @@ let pr2, pr2_once = Common.mk_pr2_wrappers Flag.verbose_visual
(* ugly *)
let root_orig () =
- (Common.last !Controller.dw_stack).M.root
+ (Common.list_last !Controller.dw_stack).M.root
(*e: view globals *)
@@ -501,7 +501,9 @@ let mk_gui ~screen_size test_mode (root, model, dw, dbfile_opt) =
tb#insert_widget (G.mk (GButton.button ~stock:`GOTO_TOP) (fun b ->
b#connect#clicked ~callback:(fun () ->
- Controller.dw_stack := [Common.last !Controller.dw_stack];
+ let top = Common.list_last !Controller.dw_stack in
+ (* put 2 in the stack because _go_back will popup one *)
+ Controller.dw_stack := [top; top];
!Controller._go_back dw;
)
Please sign in to comment.
Something went wrong with that request. Please try again.