Mercurial > projects > dang
comparison gen/CodeGen.d @ 136:2be29b296081
Lots of changes:
- Parsing classes and interfaces
- Fixed some seg faults in sema
- Supporting "private" to some extend
- And a lot of other small fixes
author | johnsen@johnsen-laptop |
---|---|
date | Fri, 11 Jul 2008 21:47:57 +0200 |
parents | ed815b31479b |
children | efbf51d85f4d |
comparison
equal
deleted
inserted
replaced
135:9869194de9b7 | 136:2be29b296081 |
---|---|
659 Value[2] gep_indices; | 659 Value[2] gep_indices; |
660 gep_indices[0] = ZeroIndex; | 660 gep_indices[0] = ZeroIndex; |
661 gep_indices[1] = index.value; | 661 gep_indices[1] = index.value; |
662 Value res; | 662 Value res; |
663 auto target = genLValue(indexExp.target).getAddress(); | 663 auto target = genLValue(indexExp.target).getAddress(); |
664 if (type.isArray()) | 664 if (type.isStaticArray()) |
665 res = b.buildGEP(target, gep_indices[0 .. 2], "index"); | 665 res = b.buildGEP(target, gep_indices[0 .. 2], "index"); |
666 else if (type.isPointer()) | 666 else if (type.isPointer()) |
667 res = b.buildGEP(target, gep_indices[1 .. 2], "index"); | 667 res = b.buildGEP(target, gep_indices[1 .. 2], "index"); |
668 else assert(0, "Can only index pointers and arrays"); | 668 else assert(0, "Can only index pointers and arrays"); |
669 return LValue(res); | 669 return LValue(res); |
887 { | 887 { |
888 Type res = PointerType.Get(llvm(f.pointerOf)); | 888 Type res = PointerType.Get(llvm(f.pointerOf)); |
889 type_map[t] = res; | 889 type_map[t] = res; |
890 return res; | 890 return res; |
891 } | 891 } |
892 else if (auto f = t.asArray) | 892 else if (auto f = t.asStaticArray) |
893 { | 893 { |
894 Type res = ArrayType.Get(llvm(f.arrayOf), f.size); | 894 Type res = ArrayType.Get(llvm(f.arrayOf), f.size); |
895 type_map[t] = res; | 895 type_map[t] = res; |
896 return res; | 896 return res; |
897 } | 897 } |