Mercurial > projects > ldc
comparison dmd/expression.c @ 599:4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 15 Sep 2008 02:04:26 +0200 |
parents | fbb1a366cfbc |
children | 8aebdf56c455 |
comparison
equal
deleted
inserted
replaced
598:13ff06605226 | 599:4435f57956e7 |
---|---|
9069 expToCBuffer(buf, hgs, e1, PREC_expr); | 9069 expToCBuffer(buf, hgs, e1, PREC_expr); |
9070 buf->writestring(" : "); | 9070 buf->writestring(" : "); |
9071 expToCBuffer(buf, hgs, e2, PREC_cond); | 9071 expToCBuffer(buf, hgs, e2, PREC_cond); |
9072 } | 9072 } |
9073 | 9073 |
9074 | 9074 /************************************************************/ |
9075 | |
9076 #if IN_LLVM | |
9077 | |
9078 // Strictly LLVMDC specific stuff | |
9079 | |
9080 GEPExp::GEPExp(Loc loc, Expression* e, Identifier* id, unsigned idx) | |
9081 : UnaExp(loc, TOKgep, sizeof(GEPExp), e) | |
9082 { | |
9083 index = idx; | |
9084 ident = id; | |
9085 } | |
9086 | |
9087 void GEPExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) | |
9088 { | |
9089 expToCBuffer(buf, hgs, e1, PREC_primary); | |
9090 buf->writeByte('.'); | |
9091 buf->writestring(ident->toChars()); | |
9092 } | |
9093 | |
9094 Expression* GEPExp::toLvalue(Scope* sc, Expression* e) | |
9095 { | |
9096 // GEP's are always lvalues, at least in the "LLVM sense" ... | |
9097 return this; | |
9098 } | |
9099 | |
9100 #endif |