Chromium Code Reviews| 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 Member method; | 8 Member method; |
| 9 | 9 |
| 10 String name; | 10 String name; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 String get generatedFactoryName() { | 189 String get generatedFactoryName() { |
| 190 assert(this.isFactory); | 190 assert(this.isFactory); |
| 191 String prefix = '${declaringType.jsname}.${constructorName}\$'; | 191 String prefix = '${declaringType.jsname}.${constructorName}\$'; |
| 192 if (name == '') { | 192 if (name == '') { |
| 193 return '${prefix}factory'; | 193 return '${prefix}factory'; |
| 194 } else { | 194 } else { |
| 195 return '${prefix}$name\$factory'; | 195 return '${prefix}$name\$factory'; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 int hashCode() => (declaringType.hashCode() << 4) ^ name.hashCode(); | 199 int hashCode() => |
|
Bob Nystrom
2011/12/06 23:11:23
I respect your desire to use =>, but this is a bit
nweiz
2011/12/07 19:26:56
Done.
| |
| 200 ((declaringType == null ? 1 : declaringType.hashCode()) << 4) ^ | |
| 201 (isConstructor ? constructorName.hashCode() : name.hashCode()); | |
| 202 | |
| 203 bool operator ==(other) => other is Member && | |
|
Bob Nystrom
2011/12/06 23:11:23
This too. :)
nweiz
2011/12/07 19:26:56
Done, although it's still just one expression.
| |
| 204 isConstructor == other.isConstructor && | |
| 205 declaringType == other.declaringType && (isConstructor ? | |
| 206 constructorName == other.constructorName : name == other.name); | |
| 200 } | 207 } |
| 201 | 208 |
| 202 | 209 |
| 203 /** | 210 /** |
| 204 * Types are treated as first class members of their library's top type. | 211 * Types are treated as first class members of their library's top type. |
| 205 */ | 212 */ |
| 206 // TODO(jmesserly): perhaps Type should extend Member, but that can get | 213 // TODO(jmesserly): perhaps Type should extend Member, but that can get |
| 207 // complicated. | 214 // complicated. |
| 208 class TypeMember extends Member { | 215 class TypeMember extends Member { |
| 209 final DefinedType type; | 216 final DefinedType type; |
| (...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1725 } | 1732 } |
| 1726 | 1733 |
| 1727 void forEach(void f(Member member)) { | 1734 void forEach(void f(Member member)) { |
| 1728 factories.forEach((_, Map constructors) { | 1735 factories.forEach((_, Map constructors) { |
| 1729 constructors.forEach((_, Member member) { | 1736 constructors.forEach((_, Member member) { |
| 1730 f(member); | 1737 f(member); |
| 1731 }); | 1738 }); |
| 1732 }); | 1739 }); |
| 1733 } | 1740 } |
| 1734 } | 1741 } |
| OLD | NEW |