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 |
11 import 'package:front_end/file_system.dart'; | 11 import 'package:front_end/file_system.dart'; |
12 import 'package:kernel/ast.dart' | 12 import 'package:kernel/ast.dart' |
13 show | 13 show |
14 Arguments, | 14 Arguments, |
15 AsyncMarker, | |
16 CanonicalName, | 15 CanonicalName, |
17 Class, | 16 Class, |
18 Constructor, | 17 Constructor, |
19 DartType, | 18 DartType, |
20 DynamicType, | 19 DynamicType, |
21 EmptyStatement, | 20 EmptyStatement, |
22 Expression, | 21 Expression, |
23 ExpressionStatement, | 22 ExpressionStatement, |
24 Field, | 23 Field, |
25 FieldInitializer, | 24 FieldInitializer, |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); | 359 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); |
361 Uri fileUri = loader.first?.fileUri ?? uri; | 360 Uri fileUri = loader.first?.fileUri ?? uri; |
362 KernelLibraryBuilder library = | 361 KernelLibraryBuilder library = |
363 new KernelLibraryBuilder(uri, fileUri, loader); | 362 new KernelLibraryBuilder(uri, fileUri, loader); |
364 loader.first = library; | 363 loader.first = library; |
365 if (isFullProgram) { | 364 if (isFullProgram) { |
366 // If this is an outline, we shouldn't add an executable main | 365 // If this is an outline, we shouldn't add an executable main |
367 // method. Similarly considerations apply to separate compilation. It | 366 // method. Similarly considerations apply to separate compilation. It |
368 // could also make sense to add a way to mark .dill files as having | 367 // could also make sense to add a way to mark .dill files as having |
369 // compile-time errors. | 368 // compile-time errors. |
370 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder( | 369 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0, |
371 null, | 370 null, "main", null, null, ProcedureKind.Method, library, -1, -1, -1); |
372 0, | |
373 null, | |
374 "main", | |
375 null, | |
376 null, | |
377 AsyncMarker.Sync, | |
378 ProcedureKind.Method, | |
379 library, | |
380 -1, | |
381 -1, | |
382 -1); | |
383 library.addBuilder(mainBuilder.name, mainBuilder, -1); | 371 library.addBuilder(mainBuilder.name, mainBuilder, -1); |
384 mainBuilder.body = new ExpressionStatement( | 372 mainBuilder.body = new ExpressionStatement( |
385 new Throw(new StringLiteral("${errors.join('\n')}"))); | 373 new Throw(new StringLiteral("${errors.join('\n')}"))); |
386 } | 374 } |
387 library.build(loader.coreLibrary); | 375 library.build(loader.coreLibrary); |
388 return link(<Library>[library.library]); | 376 return link(<Library>[library.library]); |
389 } | 377 } |
390 | 378 |
391 /// Creates a program by combining [libraries] with the libraries of | 379 /// Creates a program by combining [libraries] with the libraries of |
392 /// `dillTarget.loader.program`. | 380 /// `dillTarget.loader.program`. |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 } | 720 } |
733 for (Constructor constructor in superclass.constructors) { | 721 for (Constructor constructor in superclass.constructors) { |
734 if (constructor.name.name.isEmpty) { | 722 if (constructor.name.name.isEmpty) { |
735 return constructor.function.requiredParameterCount == 0 | 723 return constructor.function.requiredParameterCount == 0 |
736 ? constructor | 724 ? constructor |
737 : null; | 725 : null; |
738 } | 726 } |
739 } | 727 } |
740 return null; | 728 return null; |
741 } | 729 } |
OLD | NEW |