From b83afa9eca4b58c806b08d3193a69d470dd31772 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sun, 7 Dec 2008 16:02:43 +0100 Subject: [PATCH] Fix with(symbol) statement. --- gen/statements.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gen/statements.cpp b/gen/statements.cpp index 112fd352..55a51537 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -1300,9 +1300,13 @@ void WithStatement::toIR(IRState* p) assert(exp); assert(body); - DValue* e = exp->toElem(p); - LLValue* mem = DtoRawVarDeclaration(wthis); - DtoStore(e->getRVal(), mem); + // with(..) can either be used with expressions or with symbols + // wthis == null indicates the symbol form + if (wthis) { + DValue* e = exp->toElem(p); + LLValue* mem = DtoRawVarDeclaration(wthis); + DtoStore(e->getRVal(), mem); + } body->toIR(p); }