How about we override Base.call{T}(::Type{T},args...) = ( mystuff; original Base.call; )
Can i do something like this? Thanks On Sunday, January 3, 2016 at 6:58:49 PM UTC-8, Isaiah wrote: > > There is no AST-level distinction between a "constructor call" and a > "normal function call", see [1]. Look at the code in 'reflection.jl' to see > how to determine the applicable method for a given name (which may be a > constructor). If that doesn't help, it would be helpful to clarify the goal. > > For return statements, use `expand(a)` to convert the expression to goto > form, which should contain only explicit returns. > > [1] https://github.com/JuliaLang/julia/pull/8712 > > On Sun, Jan 3, 2016 at 6:52 PM, Julia Tylors <julia...@gmail.com > <javascript:>> wrote: > >> I am planning to detect the constructor calls and return statement of a >> function >> >> >> a = quote begin >> x = Foo(12) >> y = 5 + 6 >> f(x.val,y) >> x.val * y >> end >> >> a is an Expr, in this expression , I would like to detect the >> constructor calls (Foo(12)( and distinguish them from normal function >> calls(fx.val,y). >> and i also want to identify the return statement, (x.val*y). How can i do >> it programmatically? >> >> Thanks >> >> >> > >