From f5aaee30e76ee93bf795b9b3f1ef34afce7021a2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 1 Jul 2008 11:26:12 +0000 Subject: [PATCH] Make the locations in error messages more specific. --- pa_bitmatch.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pa_bitmatch.ml b/pa_bitmatch.ml index da477e7..bae6ece 100644 --- a/pa_bitmatch.ml +++ b/pa_bitmatch.ml @@ -166,8 +166,6 @@ let build_bitmatch_call _loc funcname length endian signed = (* Generate the code for a constructor, ie. 'BITSTRING ...'. *) let output_constructor _loc fields = - let fail = locfail _loc in - let loc_fname = Loc.file_name _loc in let loc_line = string_of_int (Loc.start_line _loc) in let loc_char = string_of_int (Loc.start_off _loc - Loc.start_bol _loc) in @@ -195,6 +193,8 @@ let output_constructor _loc fields = let _loc = P.get_location field in let offset = P.get_offset field in + let fail = locfail _loc in + (* offset() not supported in constructors. Implementation of * forward-only offsets is fairly straightforward: we would * need to just calculate the length of padding here and add @@ -400,8 +400,6 @@ let output_constructor _loc fields = * the list of cases to test against. *) let output_bitmatch _loc bs cases = - let fail = locfail _loc in - let data = gensym "data" and off = gensym "off" and len = gensym "len" in let result = gensym "result" in @@ -426,6 +424,8 @@ let output_bitmatch _loc bs cases = let _loc = P.get_location field in let offset = P.get_offset field in + let fail = locfail _loc in + (* Is flen (field len) an integer constant? If so, what is it? * This will be [Some i] if it's a constant or [None] if it's * non-constant or we couldn't determine. -- 1.8.3.1