| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.kernel_target; | 5 library fasta.kernel_target; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:io' show File, IOSink; | 9 import 'dart:io' show File, IOSink; |
| 10 | 10 |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 <Constructor, List<FieldInitializer>>{}; | 560 <Constructor, List<FieldInitializer>>{}; |
| 561 for (Constructor constructor in cls.constructors) { | 561 for (Constructor constructor in cls.constructors) { |
| 562 if (!isRedirectingGenerativeConstructor(constructor)) { | 562 if (!isRedirectingGenerativeConstructor(constructor)) { |
| 563 /// >If no superinitializer is provided, an implicit superinitializer | 563 /// >If no superinitializer is provided, an implicit superinitializer |
| 564 /// >of the form super() is added at the end of k’s initializer list, | 564 /// >of the form super() is added at the end of k’s initializer list, |
| 565 /// >unless the enclosing class is class Object. | 565 /// >unless the enclosing class is class Object. |
| 566 if (!constructor.initializers.any(isSuperinitializerOrInvalid)) { | 566 if (!constructor.initializers.any(isSuperinitializerOrInvalid)) { |
| 567 superTarget ??= defaultSuperConstructor(cls); | 567 superTarget ??= defaultSuperConstructor(cls); |
| 568 Initializer initializer; | 568 Initializer initializer; |
| 569 if (superTarget == null) { | 569 if (superTarget == null) { |
| 570 Uri uri = constructor.enclosingClass.fileUri == null |
| 571 ? null |
| 572 : Uri.parse(constructor.enclosingClass.fileUri); |
| 573 InputError error = new InputError( |
| 574 uri, |
| 575 constructor.fileOffset, |
| 576 "${cls.superclass.name} has no constructor that takes no" |
| 577 " arguments."); |
| 578 print(error.format()); |
| 579 errors.add(error); |
| 570 initializer = new InvalidInitializer(); | 580 initializer = new InvalidInitializer(); |
| 571 } else { | 581 } else { |
| 572 initializer = | 582 initializer = |
| 573 new SuperInitializer(superTarget, new Arguments.empty()); | 583 new SuperInitializer(superTarget, new Arguments.empty()); |
| 574 } | 584 } |
| 575 constructor.initializers.add(initializer); | 585 constructor.initializers.add(initializer); |
| 576 initializer.parent = constructor; | 586 initializer.parent = constructor; |
| 577 } | 587 } |
| 578 if (constructor.function.body == null) { | 588 if (constructor.function.body == null) { |
| 579 /// >If a generative constructor c is not a redirecting constructor | 589 /// >If a generative constructor c is not a redirecting constructor |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 } | 684 } |
| 675 for (Constructor constructor in superclass.constructors) { | 685 for (Constructor constructor in superclass.constructors) { |
| 676 if (constructor.name.name.isEmpty) { | 686 if (constructor.name.name.isEmpty) { |
| 677 return constructor.function.requiredParameterCount == 0 | 687 return constructor.function.requiredParameterCount == 0 |
| 678 ? constructor | 688 ? constructor |
| 679 : null; | 689 : null; |
| 680 } | 690 } |
| 681 } | 691 } |
| 682 return null; | 692 return null; |
| 683 } | 693 } |
| OLD | NEW |