From d76dfe7aa74070390030d8ede89e1bf9ba658d0b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 15 Jun 2006 12:19:54 +0000 Subject: handle "use base ..." --- perl_checker.spec | 1 + perl_checker.src/tree.ml | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/perl_checker.spec b/perl_checker.spec index f12b6a0..9087cb9 100644 --- a/perl_checker.spec +++ b/perl_checker.spec @@ -56,6 +56,7 @@ rm -rf $RPM_BUILD_ROOT # MODIFY IN THE CVS: cvs.mandrakesoft.com:/cooker soft/perl-MDK-Common %changelog * Thu Jun 15 2006 Pixel 1.1.25-1mdv2007.0 +- handle "use base ..." - add a fake packdrake.pm * Wed Jun 14 2006 Pixel 1.1.24-1mdv2007.0 diff --git a/perl_checker.src/tree.ml b/perl_checker.src/tree.ml index 47daf14..16fd0e4 100644 --- a/perl_checker.src/tree.ml +++ b/perl_checker.src/tree.ml @@ -186,6 +186,9 @@ let get_uses t = | Use(Ident(None, "lib", _), [libs]) -> use_lib := List.map Info.file_to_absolute_file (List.map snd (from_qw libs)) @ !use_lib ; uses + | Use(Ident(None, "base", _), classes) -> + let l = List.map (fun (pkg, pos) -> (pkg, (None, pos))) (collect from_qw_raw classes) in + l @ uses | Use(Ident(_, _, pos) as pkg, l) -> let package = string_of_fromparser pkg in if uses_external_package package then @@ -203,9 +206,12 @@ let get_uses t = let get_isa t = List.fold_left (fun (isa, exporter) e -> match e with + | Use(Ident(None, "base", pos), classes) -> + if isa <> None || exporter <> None then die_with_pos pos "\"use base\" and \"@ISA\" must be used once only"; + Some (collect from_qw_raw classes), None | List [ Call_op("=", [ Deref(I_array, Ident(None, "ISA", pos)) ; classes ], _) ] | List [ Call_op("=", [ My_our("our", [ I_array, "ISA" ], pos) ; classes ], _) ] -> - if isa <> None || exporter <> None then die_with_pos pos "@ISA set twice"; + if isa <> None || exporter <> None then die_with_pos pos "\"use base\" and \"@ISA\" must be used once only"; let special, l = List.partition (fun (s, _) -> s = "DynaLoader" || s = "Exporter") (from_qw_raw classes) in let exporter = if List.mem_assoc "Exporter" special then Some pos else None in let isa = if l = [] && special <> [] then None else Some l in -- cgit v1.2.1