Changeset 820:bb4a81e68ddb
- Timestamp:
- 12/01/08 19:20:22
(1 month ago)
- Author:
- Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
- branch:
- default
- Message:
Implemented allocating storage for a slice if its address is taken, fixes #115
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r819 |
r820 |
|
| 889 | 889 | } |
|---|
| 890 | 890 | Logger::println("is nothing special"); |
|---|
| 891 | | LLValue* lval = v->getLVal(); |
|---|
| | 891 | |
|---|
| | 892 | // we special case here, since apparently taking the address of a slice is ok |
|---|
| | 893 | LLValue* lval; |
|---|
| | 894 | if (v->isLVal()) |
|---|
| | 895 | lval = v->getLVal(); |
|---|
| | 896 | else |
|---|
| | 897 | { |
|---|
| | 898 | assert(v->isSlice()); |
|---|
| | 899 | LLValue* rval = v->getRVal(); |
|---|
| | 900 | lval = DtoAlloca(rval->getType(), ".tmp_slice_storage"); |
|---|
| | 901 | DtoStore(rval, lval); |
|---|
| | 902 | } |
|---|
| | 903 | |
|---|
| 892 | 904 | if (Logger::enabled()) |
|---|
| 893 | 905 | Logger::cout() << "lval: " << *lval << '\n'; |
|---|
| 894 | | return new DImValue(type, DtoBitCast(v->getLVal(), DtoType(type))); |
|---|
| | 906 | |
|---|
| | 907 | return new DImValue(type, DtoBitCast(lval, DtoType(type))); |
|---|
| 895 | 908 | } |
|---|
| 896 | 909 | |
|---|