On Thu, Mar 10, 2016 at 6:04 PM, Julia Tylors <juliatyl...@gmail.com> wrote:
>
>
> Hi fellows, I have a problem which i can't solve.
>
> I have a function test(x,y) which has the ast as follows:
> (test.env.defs.func.code)
>
>
> :($(Expr(:method, :test,
> :((top(svec))((top(apply_type))(Tuple,Any,Any),(top(svec))())),
> AST(:($(Expr(:lambda, Any[:x,:y],
> Any[Any[Any[:x,:Any,1],Any[:y,:Any,1],Any[:v1,:Any,7],Any[:v2,:Any,7]],Any[],0,Any[]],
> :(begin  # none, line 2:
>         NewvarNode(:v1)
>         NewvarNode(:v2)
>         v1 = 2.1
>         v2 = 2.2
>         $(Expr(:(=), :v1, :v2,
> :(((top(getfield))((top(getfield))(Transmission,:Download),:download_task))(Val{symbol("##7775")},x,y,v1,v2))))
>         return v1 + v2
>     end))))), false)))
>
>

Can you show how you generated `test`?

>
> when i call test(1.1,2.2), it returns 4.4 but it should have returned
> v1 = 1.1*2.2 = 2.42
> v2 = 2.2*2.1 = 4.62
>
> so the result should be v1+v2 , 7.04
>
> Here is the download_task function.
> @generated function download_task{id}(::Type{Val{id}}, args...)
> println("Download Task $id for argument types $args")
> :((args[1] * args[2]), (args[2] * args[3]))
> end
>
> I am suspicious about the part in bold
>
> $(Expr(:(=), :v1, :v2,
> :(((top(getfield))((top(getfield))(Transmission,:Download),:download_task))(Val{symbol("##7775")},x,y,v1,v2))))
>
> this part doesn't get executed! Or somewhat expanded wrong. I am not totally
> sure.
> Anyone with a better understanding , please help me out.!
>
> Thanks

Reply via email to