]> Repositorios git - scryer-prolog.git/commitdiff
call verify_attributes/3 once per module
authorMark Thom <[email protected]>
Wed, 13 Feb 2019 01:12:18 +0000 (18:12 -0700)
committerMark Thom <[email protected]>
Wed, 13 Feb 2019 01:12:18 +0000 (18:12 -0700)
src/prolog/lib/builtins.pl
src/prolog/machine/attributed_variables.pl

index 211bbc583553e7dd3cd9ac360750ffe595ceb087..02721d6eefa734c56c56b83b795cb70d0c67de03 100644 (file)
@@ -64,7 +64,7 @@ false :- '$fail'.
 
 Module : Predicate :-
     ( atom(Module) -> '$module_call'(Module, Predicate)
-    ; throw(error(type_error(atom, Module), (:)))
+    ; throw(error(type_error(atom, Module), (:)/2))
     ).
 
 % flags.
index c72c9e2497c52e29b041eb28c476584e363ad29f..9bfa7b2731ff685d384a516a7125ac72b7bdc980 100644 (file)
@@ -11,14 +11,24 @@ iterate([Var|VarBindings], [Value|ValueBindings], [ListOfGoalLists | ListsCubed]
     iterate(VarBindings, ValueBindings, ListsCubed).
 iterate([], [], []).
 
+gather_modules(Attrs, []) :- var(Attrs), !.
+gather_modules([Attr|Attrs], [Module|Modules]) :-
+    '$module_of'(Module, Attr),  % write the owning module of Attr to Module.
+    gather_modules(Attrs, Modules).
+
+verify_attrs([Module|Modules], Var, Value, [Goals|ListOfGoalLists]) :-
+    catch(Module:verify_attributes(Var, Value, Goals),
+          error(evaluation_error((M:verify_attributes)/3), verify_attrs/3),
+          Goals = []),
+    verify_attrs(Modules, Var, Value, ListOfGoalLists).
+verify_attrs([], _, _, []).
+
 call_verify_attributes(Attrs, _, _, []) :-
     var(Attrs), !.
-call_verify_attributes([Attr|Attrs], Var, Value, [Goals|ListOfGoalLists]) :-
-    '$module_of'(M, Attr),     % write the owning module of Attr to M.
-    catch(M:verify_attributes(Var, Value, Goals),
-          error(evaluation_error((M:verify_attributes)/3), verify_attributes/3),
-          Goals = []),
-    call_verify_attributes(Attrs, Var, Value, ListOfGoalLists).
+call_verify_attributes([Attr|Attrs], Var, Value, ListOfGoalLists) :-
+    gather_modules([Attr|Attrs], Modules0),
+    sort(Modules0, Modules),
+    verify_attrs(Modules, Var, Value, ListOfGoalLists).
 
 call_goals([ListOfGoalLists | ListsCubed]) :-
     call_goals_0(ListOfGoalLists),