annotate dmd/TypeReturn.d @ 72:2e2a5c3f943a

reduced warnings by adding override to the methods think this also normalizes different line endings used all over the place
author Trass3r
date Sat, 28 Aug 2010 16:19:48 +0200
parents 5a2059196104
children e28b18c23469
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.TypeReturn;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import dmd.Loc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.MOD;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 import dmd.TypeQualified;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 import dmd.Dsymbol;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 import dmd.OutBuffer;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 import dmd.HdrGenState;
1
5a2059196104 Project build commands update
korDen
parents: 0
diff changeset
11 import dmd.Identifier;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.TY;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 class TypeReturn : TypeQualified
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 this(Loc loc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 super(TY.Treturn, loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 version (DumbClone) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 Type clone()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 1
diff changeset
29 override Type syntaxCopy()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 TypeReturn t = new TypeReturn(loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 t.syntaxCopyHelper(this);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 t.mod = mod;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 return t;
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: 1
diff changeset
37 override Dsymbol toDsymbol(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 {
1
5a2059196104 Project build commands update
korDen
parents: 0
diff changeset
39 Type t = semantic(Loc(0), sc);
5a2059196104 Project build commands update
korDen
parents: 0
diff changeset
40 if (t is this)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 return null;
1
5a2059196104 Project build commands update
korDen
parents: 0
diff changeset
42
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 return t.toDsymbol(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 1
diff changeset
46 override Type semantic(Loc loc, Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 Type t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 if (!sc.func)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 error(loc, "typeof(return) must be inside function");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 goto Lerr;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 t = sc.func.type.nextOf();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 t = t.addMod(mod);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 if (idents.dim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 Dsymbol s = t.toDsymbol(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 for (size_t i = 0; i < idents.dim; i++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 if (!s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 Identifier id = cast(Identifier)idents.data[i];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 s = s.searchX(loc, sc, id);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 if (s)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 t = s.getType();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 if (!t)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 error(loc, "%s is not a type", s.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 goto Lerr;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 error(loc, "cannot resolve .property for %s", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 goto Lerr;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 return t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 Lerr:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 return terror;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 1
diff changeset
89 override void toCBuffer2(OutBuffer buf, HdrGenState* hgs, MOD mod)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 1
diff changeset
93 }