Chromium Code Reviews| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 show InputError, internalError, reportCrash, resetCrashReporting; | 69 show InputError, internalError, reportCrash, resetCrashReporting; |
| 70 | 70 |
| 71 import '../util/relativize.dart' show relativizeUri; | 71 import '../util/relativize.dart' show relativizeUri; |
| 72 | 72 |
| 73 import '../compiler_context.dart' show CompilerContext; | 73 import '../compiler_context.dart' show CompilerContext; |
| 74 | 74 |
| 75 import 'kernel_builder.dart' | 75 import 'kernel_builder.dart' |
| 76 show | 76 show |
| 77 Builder, | 77 Builder, |
| 78 ClassBuilder, | 78 ClassBuilder, |
| 79 InvalidTypeBuilder, | |
| 79 KernelClassBuilder, | 80 KernelClassBuilder, |
| 80 KernelLibraryBuilder, | 81 KernelLibraryBuilder, |
| 81 KernelNamedTypeBuilder, | 82 KernelNamedTypeBuilder, |
| 82 KernelProcedureBuilder, | 83 KernelProcedureBuilder, |
| 83 LibraryBuilder, | 84 LibraryBuilder, |
| 84 MixinApplicationBuilder, | 85 MixinApplicationBuilder, |
| 85 NamedMixinApplicationBuilder, | 86 NamedMixinApplicationBuilder, |
| 86 NamedTypeBuilder, | 87 NamedTypeBuilder, |
| 87 TypeBuilder, | 88 TypeBuilder, |
| 88 TypeVariableBuilder; | 89 TypeVariableBuilder; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 // We have to test if builder.cls is a mixin application. [builder] may | 399 // We have to test if builder.cls is a mixin application. [builder] may |
| 399 // think it's a mixin application, but if its mixed-in type couldn't be | 400 // think it's a mixin application, but if its mixed-in type couldn't be |
| 400 // resolved, the target class won't be a mixin application and we need | 401 // resolved, the target class won't be a mixin application and we need |
| 401 // to add a default constructor to complete error recovery. | 402 // to add a default constructor to complete error recovery. |
| 402 return; | 403 return; |
| 403 } | 404 } |
| 404 if (builder.constructors.isNotEmpty) return; | 405 if (builder.constructors.isNotEmpty) return; |
| 405 | 406 |
| 406 /// Quotes below are from [Dart Programming Language Specification, 4th | 407 /// Quotes below are from [Dart Programming Language Specification, 4th |
| 407 /// Edition]( | 408 /// Edition]( |
| 408 /// http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-408.pd f): | 409 /// http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-408.pd f): |
|
karlklose
2017/03/10 05:36:46
BTW: http://ecma-international.org/publications/fi
ahe
2017/03/10 07:38:17
Nice. And there's even room for an "s" after http.
| |
| 409 if (builder is NamedMixinApplicationBuilder) { | 410 if (builder is NamedMixinApplicationBuilder) { |
| 410 /// >A mixin application of the form S with M; defines a class C with | 411 /// >A mixin application of the form S with M; defines a class C with |
| 411 /// >superclass S. | 412 /// >superclass S. |
| 412 /// >... | 413 /// >... |
| 413 | 414 |
| 414 /// >Let LM be the library in which M is declared. For each generative | 415 /// >Let LM be the library in which M is declared. For each generative |
| 415 /// >constructor named qi(Ti1 ai1, . . . , Tiki aiki), i in 1..n of S | 416 /// >constructor named qi(Ti1 ai1, . . . , Tiki aiki), i in 1..n of S |
| 416 /// >that is accessible to LM , C has an implicitly declared constructor | 417 /// >that is accessible to LM , C has an implicitly declared constructor |
| 417 /// >named q'i = [C/S]qi of the form q'i(ai1,...,aiki) : | 418 /// >named q'i = [C/S]qi of the form q'i(ai1,...,aiki) : |
| 418 /// >super(ai1,...,aiki);. | 419 /// >super(ai1,...,aiki);. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 437 builder.charOffset, dynamicType), | 438 builder.charOffset, dynamicType), |
| 438 builder.parent); | 439 builder.parent); |
| 439 if (supertype.cls.constructors.isEmpty) { | 440 if (supertype.cls.constructors.isEmpty) { |
| 440 builder.addSyntheticConstructor(makeDefaultConstructor()); | 441 builder.addSyntheticConstructor(makeDefaultConstructor()); |
| 441 } else { | 442 } else { |
| 442 for (Constructor constructor in supertype.cls.constructors) { | 443 for (Constructor constructor in supertype.cls.constructors) { |
| 443 builder.addSyntheticConstructor(makeMixinApplicationConstructor( | 444 builder.addSyntheticConstructor(makeMixinApplicationConstructor( |
| 444 builder.cls.mixin, constructor, substitutionMap)); | 445 builder.cls.mixin, constructor, substitutionMap)); |
| 445 } | 446 } |
| 446 } | 447 } |
| 448 } else if (supertype is InvalidTypeBuilder) { | |
| 449 builder.addSyntheticConstructor(makeDefaultConstructor()); | |
| 447 } else { | 450 } else { |
| 448 internalError("Unhandled: ${supertype.runtimeType}"); | 451 internalError("Unhandled: ${supertype.runtimeType}"); |
| 449 } | 452 } |
| 450 } else { | 453 } else { |
| 451 /// >Iff no constructor is specified for a class C, it implicitly has a | 454 /// >Iff no constructor is specified for a class C, it implicitly has a |
| 452 /// >default constructor C() : super() {}, unless C is class Object. | 455 /// >default constructor C() : super() {}, unless C is class Object. |
| 453 // The superinitializer is installed below in [finishConstructors]. | 456 // The superinitializer is installed below in [finishConstructors]. |
| 454 builder.addSyntheticConstructor(makeDefaultConstructor()); | 457 builder.addSyntheticConstructor(makeDefaultConstructor()); |
| 455 } | 458 } |
| 456 } | 459 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 } | 646 } |
| 644 for (Constructor constructor in superclass.constructors) { | 647 for (Constructor constructor in superclass.constructors) { |
| 645 if (constructor.name.name.isEmpty) { | 648 if (constructor.name.name.isEmpty) { |
| 646 return constructor.function.requiredParameterCount == 0 | 649 return constructor.function.requiredParameterCount == 0 |
| 647 ? constructor | 650 ? constructor |
| 648 : null; | 651 : null; |
| 649 } | 652 } |
| 650 } | 653 } |
| 651 return null; | 654 return null; |
| 652 } | 655 } |
| OLD | NEW |