| 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.mixin_application_builder; | 5 library fasta.mixin_application_builder; |
| 6 | 6 |
| 7 import '../errors.dart' show |
| 8 internalError; |
| 9 |
| 7 import 'builder.dart' show | 10 import 'builder.dart' show |
| 8 TypeBuilder; | 11 TypeBuilder, |
| 12 TypeDeclarationBuilder; |
| 9 | 13 |
| 10 import 'scope.dart' show | 14 import 'scope.dart' show |
| 11 Scope; | 15 Scope; |
| 12 | 16 |
| 13 abstract class MixinApplicationBuilder<T extends TypeBuilder> | 17 abstract class MixinApplicationBuilder<T extends TypeBuilder> |
| 14 extends TypeBuilder { | 18 extends TypeBuilder { |
| 15 final T supertype; | 19 final T supertype; |
| 16 final List<T> mixins; | 20 final List<T> mixins; |
| 17 | 21 |
| 18 MixinApplicationBuilder(this.supertype, this.mixins); | 22 MixinApplicationBuilder(this.supertype, this.mixins); |
| 19 | 23 |
| 24 String get name => null; |
| 25 |
| 20 void resolveIn(Scope scope) { | 26 void resolveIn(Scope scope) { |
| 21 supertype.resolveIn(scope); | 27 supertype.resolveIn(scope); |
| 22 for (T t in mixins) { | 28 for (T t in mixins) { |
| 23 t.resolveIn(scope); | 29 t.resolveIn(scope); |
| 24 } | 30 } |
| 25 } | 31 } |
| 26 | 32 |
| 33 void bind(TypeDeclarationBuilder builder) { |
| 34 internalError("Internal error: can't bind a mixin application."); |
| 35 } |
| 36 |
| 27 String get debugName => "MixinApplicationBuilder"; | 37 String get debugName => "MixinApplicationBuilder"; |
| 28 | 38 |
| 29 StringBuffer printOn(StringBuffer buffer) { | 39 StringBuffer printOn(StringBuffer buffer) { |
| 30 buffer.write(supertype); | 40 buffer.write(supertype); |
| 31 buffer.write(" with "); | 41 buffer.write(" with "); |
| 32 bool first = true; | 42 bool first = true; |
| 33 for (T t in mixins) { | 43 for (T t in mixins) { |
| 34 if (!first) buffer.write(", "); | 44 if (!first) buffer.write(", "); |
| 35 first = false; | 45 first = false; |
| 36 t.printOn(buffer); | 46 t.printOn(buffer); |
| 37 } | 47 } |
| 38 return buffer; | 48 return buffer; |
| 39 } | 49 } |
| 40 } | 50 } |
| OLD | NEW |