annotate dmd/TypeExp.d @ 104:a1cf34da9ebe

+ TemplateDeclaration.toCBuffer + TypeExp.rvalue + TypeExp.toElem
author Trass3r
date Tue, 31 Aug 2010 16:35:41 +0200
parents 2e2a5c3f943a
children e28b18c23469
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
1 module dmd.TypeExp;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
2
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
3 import dmd.Expression;
104
a1cf34da9ebe + TemplateDeclaration.toCBuffer
Trass3r
parents: 72
diff changeset
4 import dmd.backend.TYM;
a1cf34da9ebe + TemplateDeclaration.toCBuffer
Trass3r
parents: 72
diff changeset
5 import dmd.backend.Util;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
6 import dmd.backend.elem;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
7 import dmd.Type;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
8 import dmd.OutBuffer;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
9 import dmd.Loc;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
10 import dmd.Scope;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
11 import dmd.IRState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
12 import dmd.HdrGenState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
13 import dmd.TOK;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
14
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 class TypeExp : Expression
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 this(Loc loc, Type type)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 {
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
19 super(loc, TOK.TOKtype, TypeExp.sizeof);
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
20 //printf("TypeExp::TypeExp(%s)\n", type->toChars());
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 this.type = type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
23
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
24 version (DumbClone) {
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
25 } else {
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
26 Type clone()
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
27 {
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
28 assert(false);
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
29 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
31 override Expression syntaxCopy()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 //printf("TypeExp.syntaxCopy()\n");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 return new TypeExp(loc, type.syntaxCopy());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
37 override Expression semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 {
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
39 //printf("TypeExp::semantic(%s)\n", type->toChars());
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
40 type = type.semantic(loc, sc);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
44 override void rvalue()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 {
104
a1cf34da9ebe + TemplateDeclaration.toCBuffer
Trass3r
parents: 72
diff changeset
46 error("type %s has no value", toChars());
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
49 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 {
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
51 type.toCBuffer(buf, null, hgs);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
54 override Expression optimize(int result)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 16
diff changeset
59 override elem* toElem(IRState* irs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 {
104
a1cf34da9ebe + TemplateDeclaration.toCBuffer
Trass3r
parents: 72
diff changeset
61 debug
a1cf34da9ebe + TemplateDeclaration.toCBuffer
Trass3r
parents: 72
diff changeset
62 writef("TypeExp.toElem()\n");
a1cf34da9ebe + TemplateDeclaration.toCBuffer
Trass3r
parents: 72
diff changeset
63
a1cf34da9ebe + TemplateDeclaration.toCBuffer
Trass3r
parents: 72
diff changeset
64 error("type %s is not an expression", toChars());
a1cf34da9ebe + TemplateDeclaration.toCBuffer
Trass3r
parents: 72
diff changeset
65 return el_long(TYint, 0);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68