OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** A formal parameter to a [Method]. */ | 5 /** A formal parameter to a [Method]. */ |
6 class Parameter { | 6 class Parameter { |
7 FormalNode definition; | 7 FormalNode definition; |
8 | 8 |
9 String name; | 9 String name; |
10 Type type; | 10 Type type; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 | 203 |
204 Type resolveType(TypeReference node, bool isRequired) { | 204 Type resolveType(TypeReference node, bool isRequired) { |
205 var type = declaringType.resolveType(node, isRequired); | 205 var type = declaringType.resolveType(node, isRequired); |
206 if (isStatic && type.hasTypeParams) { | 206 if (isStatic && type.hasTypeParams) { |
207 // TODO(jimhug): Is this really so hard? | 207 // TODO(jimhug): Is this really so hard? |
208 world.error('using type parameter in static context', | 208 world.error('using type parameter in static context', |
209 node.span); | 209 node.span); |
210 } | 210 } |
211 return type; | 211 return type; |
212 } | 212 } |
213 | |
214 int hashCode() => '${declaringType.hashCode()}:$name'.hashCode(); | |
Jennifer Messerly
2011/11/18 22:41:16
Normally I'd do this with something like:
int hash
nweiz
2011/11/18 22:48:56
I don't love the magic 4 there, but I don't love m
| |
213 } | 215 } |
214 | 216 |
215 | 217 |
216 /** | 218 /** |
217 * Types are treated as first class members of their library's top type. | 219 * Types are treated as first class members of their library's top type. |
218 */ | 220 */ |
219 // TODO(jmesserly): perhaps Type should extend Member, but that can get | 221 // TODO(jmesserly): perhaps Type should extend Member, but that can get |
220 // complicated. | 222 // complicated. |
221 class TypeMember extends Member { | 223 class TypeMember extends Member { |
222 final DefinedType type; | 224 final DefinedType type; |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1643 } | 1645 } |
1644 | 1646 |
1645 void forEach(void f(Member member)) { | 1647 void forEach(void f(Member member)) { |
1646 factories.forEach((_, Map constructors) { | 1648 factories.forEach((_, Map constructors) { |
1647 constructors.forEach((_, Member member) { | 1649 constructors.forEach((_, Member member) { |
1648 f(member); | 1650 f(member); |
1649 }); | 1651 }); |
1650 }); | 1652 }); |
1651 } | 1653 } |
1652 } | 1654 } |
OLD | NEW |