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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 /// If [builder] doesn't have a constructors, install the defaults. | 422 /// If [builder] doesn't have a constructors, install the defaults. |
423 void installDefaultConstructor(SourceClassBuilder builder) { | 423 void installDefaultConstructor(SourceClassBuilder builder) { |
424 if (builder.cls.isMixinApplication) { | 424 if (builder.cls.isMixinApplication) { |
425 // We have to test if builder.cls is a mixin application. [builder] may | 425 // We have to test if builder.cls is a mixin application. [builder] may |
426 // think it's a mixin application, but if its mixed-in type couldn't be | 426 // think it's a mixin application, but if its mixed-in type couldn't be |
427 // resolved, the target class won't be a mixin application and we need | 427 // resolved, the target class won't be a mixin application and we need |
428 // to add a default constructor to complete error recovery. | 428 // to add a default constructor to complete error recovery. |
429 return; | 429 return; |
430 } | 430 } |
431 if (builder.constructors.isNotEmpty) return; | 431 if (builder.constructors.local.isNotEmpty) return; |
432 | 432 |
433 /// Quotes below are from [Dart Programming Language Specification, 4th | 433 /// Quotes below are from [Dart Programming Language Specification, 4th |
434 /// Edition]( | 434 /// Edition]( |
435 /// https://ecma-international.org/publications/files/ECMA-ST/ECMA-408.pdf): | 435 /// https://ecma-international.org/publications/files/ECMA-ST/ECMA-408.pdf): |
436 if (builder is NamedMixinApplicationBuilder) { | 436 if (builder is NamedMixinApplicationBuilder) { |
437 /// >A mixin application of the form S with M; defines a class C with | 437 /// >A mixin application of the form S with M; defines a class C with |
438 /// >superclass S. | 438 /// >superclass S. |
439 /// >... | 439 /// >... |
440 | 440 |
441 /// >Let LM be the library in which M is declared. For each generative | 441 /// >Let LM be the library in which M is declared. For each generative |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 } | 696 } |
697 for (Constructor constructor in superclass.constructors) { | 697 for (Constructor constructor in superclass.constructors) { |
698 if (constructor.name.name.isEmpty) { | 698 if (constructor.name.name.isEmpty) { |
699 return constructor.function.requiredParameterCount == 0 | 699 return constructor.function.requiredParameterCount == 0 |
700 ? constructor | 700 ? constructor |
701 : null; | 701 : null; |
702 } | 702 } |
703 } | 703 } |
704 return null; | 704 return null; |
705 } | 705 } |
OLD | NEW |