| 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 dynamic member stub. */ | 5 /** A dynamic member stub. */ |
| 6 class VarMember { | 6 class VarMember { |
| 7 final String name; | 7 final String name; |
| 8 bool isGenerated = false; | 8 bool isGenerated = false; |
| 9 | 9 |
| 10 VarMember(this.name); | 10 VarMember(this.name); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 /** | 164 /** |
| 165 * If we have a native method overridden by a hidden native method, we need to | 165 * If we have a native method overridden by a hidden native method, we need to |
| 166 * make sure the base one has an exact type test. Otherwise we don't need | 166 * make sure the base one has an exact type test. Otherwise we don't need |
| 167 * this. | 167 * this. |
| 168 */ | 168 */ |
| 169 bool _needsExactTypeCheck() { | 169 bool _needsExactTypeCheck() { |
| 170 if (member == null || member.declaringType.isObject) return false; | 170 if (member == null || member.declaringType.isObject) return false; |
| 171 | 171 |
| 172 var members = member.declaringType.resolveMember(member.name).members; | 172 var members = member.potentialMemberSet.members; |
| 173 return members.filter((m) => m != member | 173 return members.filter((m) => m != member |
| 174 && m.declaringType.isHiddenNativeType).length >= 1; | 174 && m.declaringType.isHiddenNativeType).length >= 1; |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool _useDirectCall(Arguments args) { | 177 bool _useDirectCall(Arguments args) { |
| 178 // Create direct stubs when we can. We don't do this in some cases, such as | 178 // Create direct stubs when we can. We don't do this in some cases, such as |
| 179 // types that have native subtypes (like Object), otherwise things like | 179 // types that have native subtypes (like Object), otherwise things like |
| 180 // Object.prototype.toString$0 end up calling the toString on Object instead | 180 // Object.prototype.toString$0 end up calling the toString on Object instead |
| 181 // of on the derived type. | 181 // of on the derived type. |
| 182 if (member is MethodMember && !member.declaringType.hasNativeSubtypes) { | 182 if (member is MethodMember && !member.declaringType.hasNativeSubtypes) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 nameBuilder.add('\$'); | 265 nameBuilder.add('\$'); |
| 266 if (name.contains('\$')) { | 266 if (name.contains('\$')) { |
| 267 // Disambiguate "a:b:" from "a$b:". Using the length works well because | 267 // Disambiguate "a:b:" from "a$b:". Using the length works well because |
| 268 // the names can't start with digits. | 268 // the names can't start with digits. |
| 269 nameBuilder.add('${name.length}'); | 269 nameBuilder.add('${name.length}'); |
| 270 } | 270 } |
| 271 nameBuilder.add(name); | 271 nameBuilder.add(name); |
| 272 } | 272 } |
| 273 return nameBuilder.toString(); | 273 return nameBuilder.toString(); |
| 274 } | 274 } |
| OLD | NEW |