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:kernel/ast.dart'; | 7 import 'package:kernel/ast.dart'; |
8 | 8 |
9 import 'package:kernel/clone.dart' show | 9 import 'package:kernel/clone.dart' show |
10 CloneVisitor; | 10 CloneVisitor; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 NamedMixinApplicationBuilder, | 54 NamedMixinApplicationBuilder, |
55 PrefixBuilder, | 55 PrefixBuilder, |
56 ProcedureBuilder, | 56 ProcedureBuilder, |
57 TypeBuilder, | 57 TypeBuilder, |
58 TypeVariableBuilder; | 58 TypeVariableBuilder; |
59 | 59 |
60 class KernelLibraryBuilder | 60 class KernelLibraryBuilder |
61 extends SourceLibraryBuilder<KernelTypeBuilder, Library> { | 61 extends SourceLibraryBuilder<KernelTypeBuilder, Library> { |
62 final Library library; | 62 final Library library; |
63 | 63 |
64 final List<Class> mixinApplicationClasses = <Class>[]; | 64 final Map<String, SourceClassBuilder> mixinApplicationClasses = |
| 65 <String, SourceClassBuilder>{}; |
65 | 66 |
66 final List<List> argumentsWithMissingDefaultValues = <List>[]; | 67 final List<List> argumentsWithMissingDefaultValues = <List>[]; |
67 | 68 |
68 final List<KernelProcedureBuilder> nativeMethods = <KernelProcedureBuilder>[]; | 69 final List<KernelProcedureBuilder> nativeMethods = <KernelProcedureBuilder>[]; |
69 | 70 |
70 final List<KernelTypeVariableBuilder> boundlessTypeVariables = | 71 final List<KernelTypeVariableBuilder> boundlessTypeVariables = |
71 <KernelTypeVariableBuilder>[]; | 72 <KernelTypeVariableBuilder>[]; |
72 | 73 |
73 KernelLibraryBuilder(Uri uri, Uri fileUri, Loader loader) | 74 KernelLibraryBuilder(Uri uri, Uri fileUri, Loader loader) |
74 : library = new Library(uri, fileUri: relativizeUri(fileUri)), | 75 : library = new Library(uri, fileUri: relativizeUri(fileUri)), |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 } | 345 } |
345 boundlessTypeVariables.clear(); | 346 boundlessTypeVariables.clear(); |
346 return count; | 347 return count; |
347 } | 348 } |
348 | 349 |
349 @override | 350 @override |
350 void includePart(covariant KernelLibraryBuilder part) { | 351 void includePart(covariant KernelLibraryBuilder part) { |
351 super.includePart(part); | 352 super.includePart(part); |
352 nativeMethods.addAll(part.nativeMethods); | 353 nativeMethods.addAll(part.nativeMethods); |
353 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 354 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
354 mixinApplicationClasses.addAll(part.mixinApplicationClasses); | 355 assert(mixinApplicationClasses.isEmpty); |
355 } | 356 } |
356 } | 357 } |
357 | 358 |
358 bool isConstructorName(String name, String className) { | 359 bool isConstructorName(String name, String className) { |
359 if (name.startsWith(className)) { | 360 if (name.startsWith(className)) { |
360 if (name.length == className.length) return true; | 361 if (name.length == className.length) return true; |
361 if (name.startsWith(".", className.length)) return true; | 362 if (name.startsWith(".", className.length)) return true; |
362 } | 363 } |
363 return false; | 364 return false; |
364 } | 365 } |
OLD | NEW |