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