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_library_builder; | 5 library fasta.kernel_library_builder; |
6 | 6 |
7 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; | 7 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; |
8 import 'package:front_end/src/fasta/import.dart'; | 8 import 'package:front_end/src/fasta/import.dart'; |
9 import 'package:kernel/ast.dart'; | 9 import 'package:kernel/ast.dart'; |
10 | 10 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 addBuilder(name, builder, charOffset); | 264 addBuilder(name, builder, charOffset); |
265 if (!isNamed) { | 265 if (!isNamed) { |
266 mixinApplicationClasses[name] = builder; | 266 mixinApplicationClasses[name] = builder; |
267 } | 267 } |
268 } | 268 } |
269 return addNamedType(name, <KernelTypeBuilder>[], charOffset) | 269 return addNamedType(name, <KernelTypeBuilder>[], charOffset) |
270 ..bind(isNamed ? builder : null); | 270 ..bind(isNamed ? builder : null); |
271 } | 271 } |
272 | 272 |
273 KernelTypeBuilder applyMixins(KernelTypeBuilder type, | 273 KernelTypeBuilder applyMixins(KernelTypeBuilder type, |
274 {List<MetadataBuilder> metadata, | 274 {String documentationComment, |
| 275 List<MetadataBuilder> metadata, |
275 bool isSyntheticMixinImplementation: false, | 276 bool isSyntheticMixinImplementation: false, |
276 String name, | 277 String name, |
277 String subclassName, | 278 String subclassName, |
278 List<TypeVariableBuilder> typeVariables, | 279 List<TypeVariableBuilder> typeVariables, |
279 int modifiers: abstractMask, | 280 int modifiers: abstractMask, |
280 List<KernelTypeBuilder> interfaces, | 281 List<KernelTypeBuilder> interfaces, |
281 int charOffset: -1}) { | 282 int charOffset: -1}) { |
282 if (type is KernelMixinApplicationBuilder) { | 283 if (type is KernelMixinApplicationBuilder) { |
283 subclassName ??= name; | 284 subclassName ??= name; |
284 List<List<String>> signatureParts = <List<String>>[]; | 285 List<List<String>> signatureParts = <List<String>>[]; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 448 |
448 if (name == null) { | 449 if (name == null) { |
449 for (var type in mixin.arguments ?? const []) { | 450 for (var type in mixin.arguments ?? const []) { |
450 type.bind(variables[type.name]); | 451 type.bind(variables[type.name]); |
451 } | 452 } |
452 } | 453 } |
453 checkArguments(supertype); | 454 checkArguments(supertype); |
454 checkArguments(mixin); | 455 checkArguments(mixin); |
455 | 456 |
456 KernelNamedTypeBuilder t = applyMixin(supertype, mixin, signature, | 457 KernelNamedTypeBuilder t = applyMixin(supertype, mixin, signature, |
| 458 documentationComment: documentationComment, |
457 metadata: metadata, | 459 metadata: metadata, |
458 name: name, | 460 name: name, |
459 isSyntheticMixinImplementation: isSyntheticMixinImplementation, | 461 isSyntheticMixinImplementation: isSyntheticMixinImplementation, |
460 typeVariables: typeVariables, | 462 typeVariables: typeVariables, |
461 modifiers: modifiers, | 463 modifiers: modifiers, |
462 interfaces: interfaces, | 464 interfaces: interfaces, |
463 charOffset: charOffset); | 465 charOffset: charOffset); |
464 if (name == null) { | 466 if (name == null) { |
465 var builder = t.builder; | 467 var builder = t.builder; |
466 t = addNamedType( | 468 t = addNamedType( |
467 t.name, freeTypes.keys.map((k) => freeTypes[k]).toList(), -1); | 469 t.name, freeTypes.keys.map((k) => freeTypes[k]).toList(), -1); |
468 if (builder != null) { | 470 if (builder != null) { |
469 t.bind(builder); | 471 t.bind(builder); |
470 } | 472 } |
471 } | 473 } |
472 return t; | 474 return t; |
473 } else { | 475 } else { |
474 return type; | 476 return type; |
475 } | 477 } |
476 } | 478 } |
477 | 479 |
478 void addNamedMixinApplication( | 480 void addNamedMixinApplication( |
| 481 String documentationComment, |
479 List<MetadataBuilder> metadata, | 482 List<MetadataBuilder> metadata, |
480 String name, | 483 String name, |
481 List<TypeVariableBuilder> typeVariables, | 484 List<TypeVariableBuilder> typeVariables, |
482 int modifiers, | 485 int modifiers, |
483 KernelTypeBuilder mixinApplication, | 486 KernelTypeBuilder mixinApplication, |
484 List<KernelTypeBuilder> interfaces, | 487 List<KernelTypeBuilder> interfaces, |
485 int charOffset) { | 488 int charOffset) { |
486 // Nested declaration began in `OutlineBuilder.beginNamedMixinApplication`. | 489 // Nested declaration began in `OutlineBuilder.beginNamedMixinApplication`. |
487 endNestedDeclaration(name).resolveTypes(typeVariables, this); | 490 endNestedDeclaration(name).resolveTypes(typeVariables, this); |
488 KernelNamedTypeBuilder supertype = applyMixins(mixinApplication, | 491 KernelNamedTypeBuilder supertype = applyMixins(mixinApplication, |
| 492 documentationComment: documentationComment, |
489 metadata: metadata, | 493 metadata: metadata, |
490 name: name, | 494 name: name, |
491 typeVariables: typeVariables, | 495 typeVariables: typeVariables, |
492 modifiers: modifiers, | 496 modifiers: modifiers, |
493 interfaces: interfaces, | 497 interfaces: interfaces, |
494 charOffset: charOffset); | 498 charOffset: charOffset); |
495 checkTypeVariables(typeVariables, supertype.builder); | 499 checkTypeVariables(typeVariables, supertype.builder); |
496 } | 500 } |
497 | 501 |
498 @override | 502 @override |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 mixinApplicationClasses.putIfAbsent(name, () => builder); | 897 mixinApplicationClasses.putIfAbsent(name, () => builder); |
894 if (existing != builder) { | 898 if (existing != builder) { |
895 part.scope.local.remove(name); | 899 part.scope.local.remove(name); |
896 } | 900 } |
897 }); | 901 }); |
898 super.includePart(part); | 902 super.includePart(part); |
899 nativeMethods.addAll(part.nativeMethods); | 903 nativeMethods.addAll(part.nativeMethods); |
900 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 904 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
901 } | 905 } |
902 } | 906 } |
OLD | NEW |