Mercurial > projects > ddmd
comparison dmd/Initializer.d @ 79:43073c7c7769
updated to 2.035
also implemented a few missing functions
still crashes in Import.importAll though
author | Trass3r |
---|---|
date | Mon, 30 Aug 2010 03:57:51 +0200 |
parents | 10317f0c89a5 |
children | e28b18c23469 |
comparison
equal
deleted
inserted
replaced
78:b98fa8a4bf04 | 79:43073c7c7769 |
---|---|
1 module dmd.Initializer; | 1 module dmd.Initializer; |
2 | 2 |
3 import dmd.Loc; | 3 import dmd.Loc; |
4 import dmd.Scope; | 4 import dmd.Scope; |
5 import dmd.Type; | 5 import dmd.Type; |
6 import dmd.Util; | |
6 import dmd.ArrayTypes; | 7 import dmd.ArrayTypes; |
7 import dmd.Expression; | 8 import dmd.Expression; |
8 import dmd.OutBuffer; | 9 import dmd.OutBuffer; |
9 import dmd.HdrGenState; | 10 import dmd.HdrGenState; |
10 import dmd.VoidInitializer; | 11 import dmd.VoidInitializer; |
23 this.loc = loc; | 24 this.loc = loc; |
24 } | 25 } |
25 | 26 |
26 Initializer syntaxCopy() | 27 Initializer syntaxCopy() |
27 { | 28 { |
28 assert(false); | 29 return this; |
29 } | 30 } |
30 | 31 |
31 Initializer semantic(Scope sc, Type t) | 32 Initializer semantic(Scope sc, Type t) |
32 { | 33 { |
33 assert(false); | 34 return this; |
34 } | 35 } |
35 | 36 |
36 Type inferType(Scope sc) | 37 Type inferType(Scope sc) |
37 { | 38 { |
38 assert(false); | 39 error(loc, "cannot infer type from initializer"); |
40 halt(); | |
41 return Type.terror; | |
39 } | 42 } |
40 | 43 |
41 abstract Expression toExpression(); | 44 abstract Expression toExpression(); |
42 | 45 |
43 abstract void toCBuffer(OutBuffer buf, HdrGenState* hgs); | 46 abstract void toCBuffer(OutBuffer buf, HdrGenState* hgs); |
44 | 47 |
45 string toChars() | 48 string toChars() |
49 { | |
50 OutBuffer buf; | |
51 HdrGenState hgs; | |
52 | |
53 buf = new OutBuffer(); | |
54 toCBuffer(buf, &hgs); | |
55 return buf.toChars(); | |
56 } | |
57 | |
58 static Initializers arraySyntaxCopy(Initializers ai) | |
59 { | |
60 Initializers a = null; | |
61 | |
62 if (ai) | |
63 { | |
64 a = new Initializers(); | |
65 a.setDim(ai.dim); | |
66 for (int i = 0; i < a.dim; i++) | |
67 { Initializer e = cast(Initializer)ai.data[i]; | |
68 | |
69 e = e.syntaxCopy(); | |
70 a.data[i] = cast(void*) e; | |
71 } | |
72 } | |
73 return a; | |
74 } | |
75 | |
76 dt_t* toDt() | |
46 { | 77 { |
47 assert(false); | 78 assert(false); |
48 } | 79 } |
49 | 80 |
50 static Initializers arraySyntaxCopy(Initializers *ai) | 81 VoidInitializer isVoidInitializer() { return null; } |
51 { | |
52 assert(false); | |
53 } | |
54 | |
55 dt_t* toDt() | |
56 { | |
57 assert(false); | |
58 } | |
59 | |
60 VoidInitializer isVoidInitializer() { return null; } | |
61 | 82 |
62 StructInitializer isStructInitializer() { return null; } | 83 StructInitializer isStructInitializer() { return null; } |
63 | 84 |
64 ArrayInitializer isArrayInitializer() { return null; } | 85 ArrayInitializer isArrayInitializer() { return null; } |
65 | 86 |