OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library dart2js.resolution.compute_members; | 5 library dart2js.resolution.compute_members; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/names.dart' show | 8 import '../common/names.dart' show |
9 Identifiers; | 9 Identifiers; |
10 import '../common/resolution.dart' show | 10 import '../common/resolution.dart' show |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 307 } |
308 // TODO(johnniwinther): If [cls] is not abstract, check that for all | 308 // TODO(johnniwinther): If [cls] is not abstract, check that for all |
309 // interface members, there is a class member whose type is a subtype of | 309 // interface members, there is a class member whose type is a subtype of |
310 // the interface member. | 310 // the interface member. |
311 } | 311 } |
312 | 312 |
313 /// Checks that [cls], if it implements Function, has defined call(). | 313 /// Checks that [cls], if it implements Function, has defined call(). |
314 void checkImplementsFunctionWithCall() { | 314 void checkImplementsFunctionWithCall() { |
315 assert(!cls.isAbstract); | 315 assert(!cls.isAbstract); |
316 | 316 |
317 if (cls.asInstanceOf(compiler.functionClass) == null) return; | 317 ClassElement functionClass = compiler.coreClasses.functionClass; |
| 318 if (cls.asInstanceOf(functionClass) == null) return; |
318 if (cls.lookupMember(Identifiers.call) != null) return; | 319 if (cls.lookupMember(Identifiers.call) != null) return; |
319 // TODO(johnniwinther): Make separate methods for backend exceptions. | 320 // TODO(johnniwinther): Make separate methods for backend exceptions. |
320 // Avoid warnings on backend implementation classes for closures. | 321 // Avoid warnings on backend implementation classes for closures. |
321 if (compiler.backend.isBackendLibrary(cls.library)) return; | 322 if (compiler.backend.isBackendLibrary(cls.library)) return; |
322 | 323 |
323 reportMessage(compiler.functionClass, MessageKind.UNIMPLEMENTED_METHOD, () { | 324 reportMessage(functionClass, MessageKind.UNIMPLEMENTED_METHOD, () { |
324 reporter.reportWarningMessage( | 325 reporter.reportWarningMessage( |
325 cls, | 326 cls, |
326 MessageKind.UNIMPLEMENTED_METHOD_ONE, | 327 MessageKind.UNIMPLEMENTED_METHOD_ONE, |
327 {'class': cls.name, | 328 {'class': cls.name, |
328 'name': Identifiers.call, | 329 'name': Identifiers.call, |
329 'method': Identifiers.call, | 330 'method': Identifiers.call, |
330 'declarer': compiler.functionClass.name}); | 331 'declarer': functionClass.name}); |
331 }); | 332 }); |
332 } | 333 } |
333 | 334 |
334 /// Checks that a class member exists for every interface member. | 335 /// Checks that a class member exists for every interface member. |
335 void checkInterfaceImplementation(); | 336 void checkInterfaceImplementation(); |
336 | 337 |
337 /// Check that [declared] is a valid override of [superMember]. | 338 /// Check that [declared] is a valid override of [superMember]. |
338 void checkValidOverride(Member declared, MemberSignature superMember) { | 339 void checkValidOverride(Member declared, MemberSignature superMember) { |
339 if (superMember == null) { | 340 if (superMember == null) { |
340 // No override. | 341 // No override. |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 message: "Members have not been fully computed for $this.")); | 948 message: "Members have not been fully computed for $this.")); |
948 if (interfaceMembersAreClassMembers) { | 949 if (interfaceMembersAreClassMembers) { |
949 classMembers.forEach((_, member) { | 950 classMembers.forEach((_, member) { |
950 if (!member.isStatic) f(member); | 951 if (!member.isStatic) f(member); |
951 }); | 952 }); |
952 } else { | 953 } else { |
953 interfaceMembers.forEach((_, member) => f(member)); | 954 interfaceMembers.forEach((_, member) => f(member)); |
954 } | 955 } |
955 } | 956 } |
956 } | 957 } |
OLD | NEW |