mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-08-05 22:10:04 +02:00
[svn r112] Fixed 'case 1,2,3:' style case statements.
Fixed a bunch of bugs with return/break/continue in loops. Fixed support for the DMDFE hidden implicit return value variable. This can be needed for some foreach statements where the loop body is converted to a nested delegate, but also possibly returns from the function. Added std.math to phobos. Added AA runtime support code, done ground work for implementing AAs. Several other bugfixes.
This commit is contained in:
@@ -5870,6 +5870,7 @@ Expression *AddrExp::semantic(Scope *sc)
|
||||
{
|
||||
VarExp *dve = (VarExp *)e1;
|
||||
FuncDeclaration *f = dve->var->isFuncDeclaration();
|
||||
VarDeclaration *v = dve->var->isVarDeclaration();
|
||||
|
||||
if (f && f->isNested())
|
||||
{ Expression *e;
|
||||
@@ -5878,6 +5879,10 @@ Expression *AddrExp::semantic(Scope *sc)
|
||||
e = e->semantic(sc);
|
||||
return e;
|
||||
}
|
||||
else if (v)
|
||||
{
|
||||
v->llvmNeedsStorage = true;
|
||||
}
|
||||
}
|
||||
else if (e1->op == TOKarray)
|
||||
{
|
||||
@@ -7543,6 +7548,7 @@ Expression *XorAssignExp::semantic(Scope *sc)
|
||||
AddExp::AddExp(Loc loc, Expression *e1, Expression *e2)
|
||||
: BinExp(loc, TOKadd, sizeof(AddExp), e1, e2)
|
||||
{
|
||||
llvmFieldIndex = false;
|
||||
}
|
||||
|
||||
Expression *AddExp::semantic(Scope *sc)
|
||||
|
||||
@@ -1121,6 +1121,9 @@ struct AddExp : BinExp
|
||||
Identifier *opId_r();
|
||||
|
||||
elem *toElem(IRState *irs);
|
||||
|
||||
// LLVMDC
|
||||
bool llvmFieldIndex;
|
||||
};
|
||||
|
||||
struct MinExp : BinExp
|
||||
|
||||
@@ -4309,6 +4309,11 @@ L1:
|
||||
b = new AddrExp(e->loc, e);
|
||||
b->type = e->type->pointerTo();
|
||||
b = new AddExp(e->loc, b, new IntegerExp(e->loc, v->offset, Type::tint32));
|
||||
#if IN_LLVM
|
||||
// LLVMDC modification
|
||||
// this is *essential*
|
||||
((AddExp*)b)->llvmFieldIndex = true;
|
||||
#endif
|
||||
b->type = v->type->pointerTo();
|
||||
e = new PtrExp(e->loc, b);
|
||||
e->type = v->type;
|
||||
|
||||
@@ -1437,7 +1437,7 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
exps->push(aggr);
|
||||
size_t keysize = taa->key->size();
|
||||
keysize = (keysize + 3) & ~3;
|
||||
exps->push(new IntegerExp(0, keysize, Type::tint32));
|
||||
exps->push(new IntegerExp(0, keysize, Type::tsize_t));
|
||||
exps->push(flde);
|
||||
e = new CallExp(loc, ec, exps);
|
||||
e->type = Type::tindex; // don't run semantic() on e
|
||||
|
||||
@@ -46,6 +46,7 @@ struct ScopeStatement;
|
||||
struct TryCatchStatement;
|
||||
struct HdrGenState;
|
||||
struct InterState;
|
||||
struct CaseStatement;
|
||||
|
||||
enum TOK;
|
||||
|
||||
@@ -114,6 +115,7 @@ struct Statement : Object
|
||||
virtual CompoundStatement *isCompoundStatement() { return NULL; }
|
||||
virtual ReturnStatement *isReturnStatement() { return NULL; }
|
||||
virtual IfStatement *isIfStatement() { return NULL; }
|
||||
virtual CaseStatement* isCaseStatement() { return NULL; }
|
||||
};
|
||||
|
||||
struct ExpStatement : Statement
|
||||
@@ -436,6 +438,8 @@ struct CaseStatement : Statement
|
||||
Statement *inlineScan(InlineScanState *iss);
|
||||
|
||||
void toIR(IRState *irs);
|
||||
|
||||
CaseStatement* isCaseStatement() { return this; }
|
||||
};
|
||||
|
||||
struct DefaultStatement : Statement
|
||||
|
||||
Reference in New Issue
Block a user