Mercurial > projects > ddmd
diff dmd/DotVarExp.d @ 96:acd69f84627e
further work
author | Trass3r |
---|---|
date | Tue, 31 Aug 2010 02:12:15 +0200 |
parents | be2ab491772e |
children | 3482c73a991b |
line wrap: on
line diff
--- a/dmd/DotVarExp.d Mon Aug 30 23:08:44 2010 +0200 +++ b/dmd/DotVarExp.d Tue Aug 31 02:12:15 2010 +0200 @@ -126,9 +126,9 @@ return this; } - override int isLvalue() + override bool isLvalue() { - return 1; + return true; } override Expression toLvalue(Scope sc, Expression e) @@ -197,33 +197,24 @@ override Expression optimize(int result) { - //printf("DotVarExp.optimize(result = x%x) %s\n", result, toChars()); + //writef("DotVarExp.optimize(result = x%x) %s\n", result, toChars()); e1 = e1.optimize(result); + Expression e = e1; + if (e1.op == TOK.TOKvar) { VarExp ve = cast(VarExp)e1; VarDeclaration v = ve.var.isVarDeclaration(); - Expression e = expandVar(result, v); - if (e && e.op == TOK.TOKstructliteral) - { - StructLiteralExp sle = cast(StructLiteralExp)e; - VarDeclaration vf = var.isVarDeclaration(); - if (vf) - { - e = sle.getField(type, vf.offset); - if (e && e !is EXP_CANT_INTERPRET) - return e; - } - } + e = expandVar(result, v); } - else if (e1.op == TOK.TOKstructliteral) - { - StructLiteralExp sle = cast(StructLiteralExp)e1; + if (e && e.op == TOK.TOKstructliteral) + { + StructLiteralExp sle = cast(StructLiteralExp) e; VarDeclaration vf = var.isVarDeclaration(); if (vf) { - Expression e = sle.getField(type, vf.offset); + e = sle.getField(type, vf.offset); if (e && e !is EXP_CANT_INTERPRET) return e; }