Mercurial > projects > ldc
comparison gen/llvmhelpers.cpp @ 295:895e1b50cf2a trunk
[svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42;
There was problems with most non basic types...
Added an option to premake so we can do: premake --target gnu --no-boehm
to disable the Boehm GC.
author | lindquist |
---|---|
date | Mon, 23 Jun 2008 14:48:42 +0200 |
parents | 94435b0ab2dd |
children | bef811104734 |
comparison
equal
deleted
inserted
replaced
294:94435b0ab2dd | 295:895e1b50cf2a |
---|---|
343 | 343 |
344 Type* t = DtoDType(lhs->getType()); | 344 Type* t = DtoDType(lhs->getType()); |
345 Type* t2 = DtoDType(rhs->getType()); | 345 Type* t2 = DtoDType(rhs->getType()); |
346 | 346 |
347 if (t->ty == Tstruct) { | 347 if (t->ty == Tstruct) { |
348 if (t2 != t) { | 348 if (!t->equals(t2)) { |
349 // TODO: fix this, use 'rhs' for something | 349 // TODO: fix this, use 'rhs' for something |
350 DtoAggrZeroInit(lhs->getLVal()); | 350 DtoAggrZeroInit(lhs->getLVal()); |
351 } | 351 } |
352 else if (!rhs->inPlace()) { | 352 else if (!rhs->inPlace()) { |
353 DtoAggrCopy(lhs->getLVal(), rhs->getRVal()); | 353 DtoAggrCopy(lhs->getLVal(), rhs->getRVal()); |
357 // lhs is slice | 357 // lhs is slice |
358 if (DSliceValue* s = lhs->isSlice()) { | 358 if (DSliceValue* s = lhs->isSlice()) { |
359 if (DSliceValue* s2 = rhs->isSlice()) { | 359 if (DSliceValue* s2 = rhs->isSlice()) { |
360 DtoArrayCopySlices(s, s2); | 360 DtoArrayCopySlices(s, s2); |
361 } | 361 } |
362 else if (t->next == t2) { | 362 else if (t->next->equals(t2)) { |
363 if (s->len) | 363 DtoArrayInit(s, rhs); |
364 DtoArrayInit(s->ptr, s->len, rhs->getRVal()); | |
365 else | |
366 DtoArrayInit(s->ptr, rhs->getRVal()); | |
367 } | 364 } |
368 else { | 365 else { |
369 DtoArrayCopyToSlice(s, rhs); | 366 DtoArrayCopyToSlice(s, rhs); |
370 } | 367 } |
371 } | 368 } |
386 else if (t->ty == Tsarray) { | 383 else if (t->ty == Tsarray) { |
387 if (DtoType(lhs->getType()) == DtoType(rhs->getType())) { | 384 if (DtoType(lhs->getType()) == DtoType(rhs->getType())) { |
388 DtoStaticArrayCopy(lhs->getLVal(), rhs->getRVal()); | 385 DtoStaticArrayCopy(lhs->getLVal(), rhs->getRVal()); |
389 } | 386 } |
390 else { | 387 else { |
391 DtoArrayInit(lhs->getLVal(), rhs->getRVal()); | 388 DtoArrayInit(lhs, rhs); |
392 } | 389 } |
393 } | 390 } |
394 else if (t->ty == Tdelegate) { | 391 else if (t->ty == Tdelegate) { |
395 if (rhs->isNull()) | 392 if (rhs->isNull()) |
396 DtoAggrZeroInit(lhs->getLVal()); | 393 DtoAggrZeroInit(lhs->getLVal()); |