changeset 831:7e59caf41433

Fix with(symbol) statement.
author Christian Kamm <kamm incasoftware de>
date Sun, 07 Dec 2008 16:02:43 +0100
parents 504a21e81a46
children 0cc0c6b53372
files gen/statements.cpp
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gen/statements.cpp	Sun Dec 07 14:12:39 2008 +0100
+++ b/gen/statements.cpp	Sun Dec 07 16:02:43 2008 +0100
@@ -1300,9 +1300,13 @@
     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);
 }