[svn r131] Fixed #11

All associative array properties now work as they should.

Fixed problems with some cases of array.length and array.ptr.

Fixed some problems with array properties.

Fixed 'in' contracts.
This commit is contained in:
Tomas Lindquist Olsen
2007-11-30 12:56:52 +01:00
parent 32ebd9617e
commit 0a226c956f
10 changed files with 169 additions and 61 deletions

View File

@@ -808,8 +808,10 @@ llvm::Value* DtoArrayLen(DValue* v)
return s->len;
}
const llvm::ArrayType* arrTy = isaArray(s->ptr->getType()->getContainedType(0));
assert(arrTy);
return DtoConstSize_t(arrTy->getNumElements());
if (arrTy)
return DtoConstSize_t(arrTy->getNumElements());
else
return DtoLoad(DtoGEPi(s->ptr, 0,0, "tmp"));
}
return DtoLoad(DtoGEPi(v->getRVal(), 0,0, "tmp"));
}
@@ -831,9 +833,13 @@ llvm::Value* DtoArrayPtr(DValue* v)
if (t->ty == Tarray) {
if (DSliceValue* s = v->isSlice()) {
if (s->len) return s->ptr;
const llvm::Type* t = s->ptr->getType()->getContainedType(0);
Logger::cout() << "ptr of full slice: " << *s->ptr << '\n';
const llvm::ArrayType* arrTy = isaArray(s->ptr->getType()->getContainedType(0));
assert(arrTy);
return DtoGEPi(s->ptr, 0,0, "tmp");
if (arrTy)
return DtoGEPi(s->ptr, 0,0, "tmp");
else
return DtoLoad(DtoGEPi(s->ptr, 0,1, "tmp"));
}
return DtoLoad(DtoGEPi(v->getRVal(), 0,1, "tmp"));
}