OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.class_hierarchy; | 5 library dart2js.resolution.class_hierarchy; |
6 | 6 |
7 import '../compiler.dart' show | 7 import '../compiler.dart' show |
8 Compiler, | 8 Compiler; |
9 isPrivateName; | |
10 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
11 import '../diagnostics/invariant.dart' show | 10 import '../diagnostics/invariant.dart' show |
12 invariant; | 11 invariant; |
13 import '../diagnostics/messages.dart' show | 12 import '../diagnostics/messages.dart' show |
14 MessageKind; | 13 MessageKind; |
15 import '../elements/elements.dart'; | 14 import '../elements/elements.dart'; |
16 import '../elements/modelx.dart' show | 15 import '../elements/modelx.dart' show |
17 BaseClassElementX, | 16 BaseClassElementX, |
18 ErroneousElementX, | 17 ErroneousElementX, |
19 MixinApplicationElementX, | 18 MixinApplicationElementX, |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 399 |
401 assert(mixinApplication.mixinType == null); | 400 assert(mixinApplication.mixinType == null); |
402 mixinApplication.mixinType = resolveMixinFor(mixinApplication, mixinType); | 401 mixinApplication.mixinType = resolveMixinFor(mixinApplication, mixinType); |
403 | 402 |
404 // Create forwarding constructors for constructor defined in the superclass | 403 // Create forwarding constructors for constructor defined in the superclass |
405 // because they are now hidden by the mixin application. | 404 // because they are now hidden by the mixin application. |
406 superclass.forEachLocalMember((Element member) { | 405 superclass.forEachLocalMember((Element member) { |
407 if (!member.isGenerativeConstructor) return; | 406 if (!member.isGenerativeConstructor) return; |
408 FunctionElement forwarder = | 407 FunctionElement forwarder = |
409 createForwardingConstructor(member, mixinApplication); | 408 createForwardingConstructor(member, mixinApplication); |
410 if (isPrivateName(member.name) && | 409 if (Name.isPrivateName(member.name) && |
411 mixinApplication.library != superclass.library) { | 410 mixinApplication.library != superclass.library) { |
412 // Do not create a forwarder to the super constructor, because the mixin | 411 // Do not create a forwarder to the super constructor, because the mixin |
413 // application is in a different library than the constructor in the | 412 // application is in a different library than the constructor in the |
414 // super class and it is not possible to call that constructor from the | 413 // super class and it is not possible to call that constructor from the |
415 // library using the mixin application. | 414 // library using the mixin application. |
416 return; | 415 return; |
417 } | 416 } |
418 mixinApplication.addConstructor(forwarder); | 417 mixinApplication.addConstructor(forwarder); |
419 }); | 418 }); |
420 calculateAllSupertypes(mixinApplication); | 419 calculateAllSupertypes(mixinApplication); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 Identifier selector = node.selector.asIdentifier(); | 673 Identifier selector = node.selector.asIdentifier(); |
675 var e = prefixElement.lookupLocalMember(selector.source); | 674 var e = prefixElement.lookupLocalMember(selector.source); |
676 if (e == null || !e.impliesType) { | 675 if (e == null || !e.impliesType) { |
677 error(node.selector, MessageKind.CANNOT_RESOLVE_TYPE, | 676 error(node.selector, MessageKind.CANNOT_RESOLVE_TYPE, |
678 {'typeName': node.selector}); | 677 {'typeName': node.selector}); |
679 return; | 678 return; |
680 } | 679 } |
681 loadSupertype(e, node); | 680 loadSupertype(e, node); |
682 } | 681 } |
683 } | 682 } |
OLD | NEW |