From 059cf5f68b1a1c3463a1ce2de2b63ddbe8ab0670 Mon Sep 17 00:00:00 2001 From: Daniel Olsson <danol716@student.liu.se> Date: Thu, 10 Oct 2019 13:11:27 +0200 Subject: [PATCH] tried change line number but the object is immutable so could not change them --- julia/dowhile.jl | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/julia/dowhile.jl b/julia/dowhile.jl index 00afdde..e4df3f5 100644 --- a/julia/dowhile.jl +++ b/julia/dowhile.jl @@ -1,3 +1,25 @@ +function adjustLines(res, macrofile, invokedFile, invokedLine ) + sz =size(res.args) + dump(res) + temp = copy(res) + for i=1:sz[1] + if isa(temp.args[i], LineNumberNode) + if (String(temp.args[i].file) == macrofile) + file = temp.args[i].line = invokedLine + end + + #println(i) + #println(res.args[i].file) + else + #println(i) + #println("Nej") + end + #println(i) + #println(res.args[i].args) + end + return res +end + macro doWhile(block, cond) # println("__source__ ", __source__) #println("cond ", cond) @@ -11,7 +33,8 @@ macro doWhile(block, cond) $(esc(block)) end end - #print(__source__.line) - #println(res) # Should not print any lines referencing dowhile.jl + res = adjustLines(res,@__FILE__(), __source__.file, __source__.line) + println("Here is the whole") + println(res) # Should not print any lines referencing dowhile.jl res end -- GitLab