Changeset 4532 for trunk/compiler

Show
Ignore:
Timestamp:
10/22/08 17:38:04 (3 months ago)
Author:
pmoura
Message:

Updated the Logtalk compiler to provide file information when printing redefined entity warnings if the files of the new and the old definitions are different (requires support for the file/2 entity property).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/compiler/logtalk.pl

    r4531 r4532  
    42334233 
    42344234 
    4235 % '$lgt_check_redefined_entities' 
     4235% '$lgt_check_redefined_entities'(+atom) 
    42364236% 
    42374237% check and print a warning for all entities that are about to be redefined; 
     
    42434243    ;   '$lgt_pp_file_rclause_'('$lgt_current_object_'(Entity, _, _, _, _, _, _, _, _, _, _)) 
    42444244    ), 
    4245     '$lgt_redefined_entity'(Entity, Type), 
    4246     '$lgt_report_redefined_entity'(Type, Entity), 
     4245    '$lgt_redefined_entity'(Entity, Type, File), 
     4246    '$lgt_report_redefined_entity'(Type, Entity, File), 
    42474247    '$lgt_retract_old_runtime_clauses'(Entity), 
    42484248    fail. 
     
    42524252 
    42534253 
    4254 % '$lgt_redefined_entity'(@entity_identifier, -atom) 
     4254% '$lgt_redefined_entity'(+atom, @entity_identifier, -atom, -atom) 
    42554255% 
    42564256% true if an entity of the same name is already loaded; returns entity type 
    42574257 
    4258 '$lgt_redefined_entity'(Entity, Type) :- 
     4258'$lgt_redefined_entity'(Entity, Type, File) :- 
    42594259    (   '$lgt_current_object_'(Entity, _, _, _, _, _, _, _, _, _, _) -> 
    42604260        Type = object 
     
    42634263    ;   '$lgt_current_category_'(Entity, _, _, _, _, _) -> 
    42644264        Type = category 
     4265    ), 
     4266    (   '$lgt_entity_property_'(Entity, file(OldBase, OldPath)), 
     4267        '$lgt_pp_file_rclause_'('$lgt_entity_property_'(Entity, file(NewBase, NewPath))), 
     4268        (OldPath \== NewPath; OldBase \== NewBase) -> 
     4269        atom_concat(OldPath, OldBase, File) 
     4270    ;   File = nil 
    42654271    ). 
    42664272 
     
    42714277% prints a warning for redefined entities 
    42724278 
    4273 '$lgt_report_redefined_entity'(Type, Entity) :- 
     4279'$lgt_report_redefined_entity'(Type, Entity, File) :- 
    42744280    (   '$lgt_compiler_flag'(report, on) -> 
    42754281        '$lgt_inc_load_warnings_counter', 
    42764282        write('    WARNING!  Redefining '), write(Type), write(' '),  
    4277         current_output(Output), '$lgt_pretty_print_vars_quoted'(Output, Entity), nl 
     4283        current_output(Output), '$lgt_pretty_print_vars_quoted'(Output, Entity), nl, 
     4284        (   File == nil -> 
     4285            true 
     4286        ;   write('              loaded from file '), write(File), nl 
     4287        ) 
    42784288    ;   true 
    42794289    ).