4
%% Copyright Ericsson AB 2002-2009. All Rights Reserved.
4
%% Copyright Ericsson AB 2002-2011. All Rights Reserved.
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
67
67
%% Called by compiler or ets/dbg:fun2ms when errors/warnings occur
70
-spec(format_error(Error) -> Chars when
71
Error :: {error, module(), term()},
72
Chars :: io_lib:chars()).
69
74
format_error({?WARN_SHADOW_VAR,Name}) ->
71
76
io_lib:format("variable ~p shadowed in ms_transform fun head",
187
192
%% Called when translating in shell
195
-spec transform_from_shell(Dialect, Clauses, BoundEnvironment) -> term() when
196
Dialect :: ets | dbg,
197
Clauses :: [erl_parse:abstract_clause()],
198
BoundEnvironment :: erl_eval:binding_struct().
189
200
transform_from_shell(Dialect, Clauses, BoundEnvironment) ->
190
201
SaveFilename = setup_filename(),
191
202
case catch ms_clause_list(1,Clauses,Dialect,gb_sets:new()) of
212
223
%% Called when translating during compiling
226
-spec parse_transform(Forms, Options) -> Forms when
227
Forms :: [erl_parse:abstract_form()],
214
230
parse_transform(Forms, _Options) ->
215
231
SaveFilename = setup_filename(),
216
232
%io:format("Forms: ~p~n",[Forms]),
317
333
form(AnyOther) ->
319
335
function(Name, Arity, Clauses0) ->
320
{Clauses1,_} = clauses(Clauses0,gb_sets:new()),
336
Clauses1 = clauses(Clauses0),
321
337
{Name,Arity,Clauses1}.
322
clauses([C0|Cs],Bound) ->
323
{C1,Bound1} = clause(C0,Bound),
324
{C2,Bound2} = clauses(Cs,Bound1),
326
clauses([],Bound) -> {[],Bound}.
339
C1 = clause(C0,gb_sets:new()),
327
344
clause({clause,Line,H0,G0,B0},Bound) ->
328
345
{H1,Bound1} = copy(H0,Bound),
329
{B1,Bound2} = copy(B0,Bound1),
330
{{clause,Line,H1,G0,B1},Bound2}.
346
{B1,_Bound2} = copy(B0,Bound1),
347
{clause,Line,H1,G0,B1}.
332
349
copy({call,Line,{remote,_Line2,{atom,_Line3,ets},{atom,_Line4,fun2ms}},