[m-dev.] trivial diff: fix goal wrapping for record syntax
Simon Taylor
stayl at cs.mu.OZ.AU
Thu Jan 4 16:57:05 AEDT 2001
I've committed this on the main branch and on the version-0_10_x branch.
Simon.
Estimated hours taken: 0.1
compiler/make_hlds.m:
Don't wrap the goals added by the compiler for a record syntax
expression in a `some' to make mode analysis treat them as an atomic
goal, because that is not consistent with how other goals are handled.
Index: make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.362
diff -u -u -r1.362 make_hlds.m
--- make_hlds.m 2000/12/18 07:40:26 1.362
+++ make_hlds.m 2001/01/04 05:27:54
@@ -5611,7 +5611,8 @@
SubContext0, FieldNames, FieldValueVar, TermInputVar,
TermOutputVar, VarSet0, VarSet,
Functor, FieldSubContext, Goals, Info0, Info),
- { wrap_field_access_goals(Context, Goals, Goal) }.
+ { goal_info_init(Context, GoalInfo) },
+ { conj_list_to_goal(Goals, GoalInfo, Goal) }.
:- pred expand_set_field_function_call_2(prog_context,
unify_main_context, unify_sub_contexts,
@@ -5710,7 +5711,8 @@
FieldNames, FieldValueVar, TermOutputVar, VarSet0, VarSet,
Functor, FieldSubContext, Goals1, Info0, Info),
{ Goals = [UnifyDCG | Goals1] },
- { wrap_field_access_goals(Context, Goals, Goal) }.
+ { goal_info_init(Context, GoalInfo) },
+ { conj_list_to_goal(Goals, GoalInfo, Goal) }.
% Expand a field extraction function call into a list of goals which
% each get one level of the structure.
@@ -5736,7 +5738,8 @@
expand_get_field_function_call_2(Context, MainContext, SubContext0,
FieldNames, FieldValueVar, TermInputVar,
VarSet0, VarSet, Functor, FieldSubContext, Goals, Info0, Info),
- { wrap_field_access_goals(Context, Goals, Goal) }.
+ { goal_info_init(Context, GoalInfo) },
+ { conj_list_to_goal(Goals, GoalInfo, Goal) }.
:- pred expand_get_field_function_call_2(prog_context, unify_main_context,
unify_sub_contexts, field_list, prog_var,
@@ -5800,24 +5803,6 @@
Functor = cons(FuncName, Arity),
create_atomic_unification(RetArg, functor(Functor, Args),
Context, MainContext, SubContext, Goal).
-
- % Wrap the list of goals for a record syntax expression
- % so that mode analysis treats them as an atomic goal -- if
- % the user writes an atomic goal which is expanded into multiple
- % goals by the compiler, the mode correctness of the goal should
- % not depend on the ability of mode analysis to interleave the
- % expanded parts with other goals.
-:- pred wrap_field_access_goals(prog_context, list(hlds_goal), hlds_goal).
-:- mode wrap_field_access_goals(in, in, out) is det.
-
-wrap_field_access_goals(Context, Goals, Goal) :-
- ( Goals = [Goal0] ->
- Goal = Goal0
- ;
- goal_info_init(Context, GoalInfo),
- Conj = conj(Goals) - GoalInfo,
- Goal = some([], can_remove, Conj) - GoalInfo
- ).
:- type field_list == assoc_list(ctor_field_name, list(prog_term)).
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list