Kai, thank you for the debugger:start() it really made a difference :)
Evan,
What if we throw this in:
NewNewForm = erl_syntax:revert_forms(erl_syntax:revert(NewForms)),
ParseTransforms = [pmod_pt, boss_db_pt|proplists:get_value(parse_transforms, Options, [])],
RevertedForms = lists:foldl(fun(Mod, Acc) ->
Mod:parse_transform(Acc, CompilerOptions)
end, NewNewForm, ParseTransforms),
erl_syntax:revert_forms(erl_syntax:revert(NewForms)) converts code that looks like this:
[{attribute,1,file,{"puppy.erl",1}},
{attribute,{1,2},module,{puppy,['Id']}},
{tree,attribute,
{attr,0,[],none},
{attribute,
{tree,atom,{attr,0,[],none},export},
[{tree,list,
{attr,0,[],none},
{list,
[{tree,arity_qualifier,
{attr,0,[],none},
{arity_qualifier,
{tree,atom,{attr,0,[],none},attribute_names},
{tree,integer,{attr,0,[],none},0}}}],
Into:
[{attribute,1,file,{"puppy.erl",1}},
{attribute,{1,2},module,{puppy,['Id']}},
{attribute,0,export,[{attribute_names,0}]},
{attribute,0,export,[{attribute_types,0}]},
{attribute,0,export,[{database_columns,0}]},
{attribute,0,export,[{database_table,0}]},
{attribute,0,export,[{validate_types,0}]},
{attribute,0,export,[{validate,0}]},
{attribute,0,export,[{save,0}]},
{attribute,0,export,[{set,1}]},
{attribute,0,export,[{set,2}]},
{attribute,0,export,[{attributes,0}]},
{attribute,0,export,[{belongs_to_names,0}]},
{attribute,0,export,[{belongs_to,0}]},
{attribute,0,export,[{id,0}]},
{attribute,0,export,[{get,1}]},
{attribute,{2,2},export,[{blah,0}]},
{function,{4,1},blah,0,[{clause,{4,1},[],[],[{atom,{4,11},ok}]}]},
{function,0,attribute_names,0,
[{clause,0,[],[],[{cons,0,{atom,0,id},{nil,0}}]}]},
{function,0,attribute_types,0,[{clause,0,[],[],[{nil,0}]}]},
{function,0,database_columns,0,
[{clause,0,[],[],
[{cons,0,{tuple,0,[{atom,0,id},{string,0,"id"}]},{nil,0}}]}]},
{function,0,database_table,0,[{clause,0,[],[],[{string,0,"puppies"}]}]},
{function,0,validate_types,0,
[{clause,0,[],[],
and that is what the parse transform from OTP expects?
Because when I used
http://www.erlang.org/doc/man/erl_syntax.html#is_tree-1 on the result of just erl_syntax:revert(NewForms) which is what is in boss_db right now, it returned 'false' which means that it is in "old style" parse transform tree, and the pmod_pt expects "new" style? That's what I gather from erlang docs and eye balling this line
https://github.com/erlang/pmod_transform/blob/master/src/pmod_pt.erl#L186Still tinkering with it...
-rambocoder