From 71b18cb33372d2d98e47ae76bf325ddc49bf5415 Mon Sep 17 00:00:00 2001 From: Daniel Olsson <danol716@student.liu.se> Date: Tue, 8 Oct 2019 09:24:45 +0200 Subject: [PATCH] Macro works now but does not give correct line number --- julia/dowhile.jl | 10 ++++++---- julia/run.jl | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/julia/dowhile.jl b/julia/dowhile.jl index 5f77067..4cd7c3a 100644 --- a/julia/dowhile.jl +++ b/julia/dowhile.jl @@ -2,11 +2,13 @@ macro doWhile(block, cond) println("__source__ ", __source__) println("cond ", cond) println("block ", block) - res = quote - error("TODO: Your code here") - - + res = quote + #error("TODO: Your code here") + $(esc(block)) + while $(esc(cond)) + $(esc(block)) + end end println(res) # Should not print any lines referencing dowhile.jl res diff --git a/julia/run.jl b/julia/run.jl index e0495f9..0f4341a 100644 --- a/julia/run.jl +++ b/julia/run.jl @@ -30,7 +30,7 @@ end m = Base.methods(Problem1.f, [Int]) Base.delete_method(m.ms[1]) @assert 2 == Problem1.f(1) -println(Problem1.f(1)) + # TODO: Make an until block for Julia, similar to do {} while (cond); in C # # Make sure that any assertions and error-messages refer to lines in the original code. -- GitLab