[m-rev.] for review: make pred names for lambdas unique
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed May 25 15:41:40 AEST 2005
On 25-May-2005, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> origin_name(Origin, Name0) = Name :-
> (
> - Origin = lambda(FileName0, LineNum, UniqueId),
> + Origin = lambda(FileName0, LineNum, SeqNo),
> ( string__append("IntroducedFrom", _, Name0) ->
> - ( string__remove_suffix(FileName0, ".m", FileName1) ->
> - FileName2 = FileName1
> + string__replace_all(FileName0, ".", "_", FileName),
> + (
> + SeqNo > 1
> + ->
> + string__format("lambda%d_%s_%d",
> + [i(SeqNo), s(FileName), i(LineNum)],
> + Name)
> ;
> - FileName2 = FileName0
> - ),
> - string__replace_all(FileName2, ".", "_", FileName),
> - string__format("lambda_%d_%s_%d",
> - [i(UniqueId), s(FileName), i(LineNum)], Name)
> + string__format("lambda_%s_%d",
> + [s(FileName), i(LineNum)], Name)
> + )
It looks like the file could use four-space indentation. That should be a
separate change, though.
> + lambdas_per_context :: map(prog_context, counter),
> + % How many lambda expressions
> + % there are at different
> + % contexts in the module.
> + % This is used to uniquely
> + % identify lambda expression
> + % that appear on the same
> + % line of the same file.
s/expression/expressions/
> +module_info_next_lambda_count(Context, Count, MI0, MI) :-
> + module_info_get_lambdas_per_context(MI0, ContextCounter0),
> + (
> + map.insert(ContextCounter0, Context, counter.init(2),
> + FoundContextCounter)
> + ->
> + Count = 1,
> + ContextCounter = FoundContextCounter
> + ;
> + map.lookup(ContextCounter0, Context, Counter0),
> + counter.allocate(Count, Counter0, Counter),
> + map.set(ContextCounter0, Context, Counter, ContextCounter)
> + ),
> + module_info_set_lambdas_per_context(ContextCounter, MI0, MI).
s/map.set/map.det_update/
> tests/debugger/declarative/ho2.exp2:
> tests/debugger/declarative/trust.exp:
> tests/hard_coded/deconstruct_arg.exp:
> - Expect the new unique predicate names.
> + Expect the new (more) unique predicate names.
I expect some of the .exp* files also need updating, but otherwise,
the diff is fine.
Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list