Mercurial > projects > dang
comparison sema/Symbol.d @ 168:7982eb63c0eb
Some changes to get function overloading to work. Also class inherit works now - to some extend. needs vtables and all the complex stuff of it.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Thu, 24 Jul 2008 12:06:48 +0200 |
parents | 57b0b4464a0b |
children |
comparison
equal
deleted
inserted
replaced
166:9cfa33517526 | 168:7982eb63c0eb |
---|---|
38 n ~= type.mangle(); | 38 n ~= type.mangle(); |
39 return n; | 39 return n; |
40 } | 40 } |
41 | 41 |
42 /** | 42 /** |
43 Try to find a contained symbol with the given name - returns null if not | 43 Try to find a contained symbol with the given name |
44 found | |
45 **/ | 44 **/ |
46 Symbol[] findMembers(char[] member) | 45 Symbol[] findMembers(char[] member) |
47 { | 46 { |
48 Symbol[] res; | 47 Symbol[] res; |
49 foreach (possible; actual.contained) | 48 foreach (possible; actual.contained) |
50 if (possible.name == member) | 49 if (possible.name == member) |
50 res ~= possible; | |
51 | |
52 if (!res.length && actual.type.isClass) | |
53 { | |
54 foreach (base ; (cast(ClassDecl)actual.decl).baseClasses) | |
55 if (base.type.isClass) | |
56 res ~= base.getSymbol.findMembers(member); | |
57 } | |
58 return res; | |
59 } | |
60 | |
61 /** | |
62 Try to find a contained symbol with the given name, who's type is a DFunction | |
63 **/ | |
64 Symbol[] findFunctionMembers(char[] member) | |
65 { | |
66 Symbol[] res; | |
67 foreach (possible; actual.contained) | |
68 if (possible.name == member && possible.type.isFunction) | |
51 res ~= possible; | 69 res ~= possible; |
52 return res; | 70 return res; |
53 } | 71 } |
54 | 72 |
55 /** | 73 /** |
101 Symbol actual; | 119 Symbol actual; |
102 // If this symbol is contained within a struct or similar this will point | 120 // If this symbol is contained within a struct or similar this will point |
103 // to that symbol | 121 // to that symbol |
104 Symbol parent; | 122 Symbol parent; |
105 | 123 |
124 char[] toString() | |
125 { | |
126 return getMangledFQN; | |
127 } | |
128 | |
106 private: | 129 private: |
107 // Helper for getMangledFQN - gets the FQN without _D and the type | 130 // Helper for getMangledFQN - gets the FQN without _D and the type |
108 char[] internalFQN() | 131 char[] internalFQN() |
109 { | 132 { |
110 if (actual.name !is null && actual.name.length > 0) | 133 if (actual.name !is null && actual.name.length > 0) |