| 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 'package:kernel/ast.dart' | 9 import 'package:kernel/ast.dart' |
| 10 show | 10 show |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); | 324 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); |
| 325 Uri fileUri = loader.first?.fileUri ?? uri; | 325 Uri fileUri = loader.first?.fileUri ?? uri; |
| 326 KernelLibraryBuilder library = | 326 KernelLibraryBuilder library = |
| 327 new KernelLibraryBuilder(uri, fileUri, loader, false); | 327 new KernelLibraryBuilder(uri, fileUri, loader, false); |
| 328 loader.first = library; | 328 loader.first = library; |
| 329 if (isFullProgram) { | 329 if (isFullProgram) { |
| 330 // If this is an outline, we shouldn't add an executable main | 330 // If this is an outline, we shouldn't add an executable main |
| 331 // method. Similarly considerations apply to separate compilation. It | 331 // method. Similarly considerations apply to separate compilation. It |
| 332 // could also make sense to add a way to mark .dill files as having | 332 // could also make sense to add a way to mark .dill files as having |
| 333 // compile-time errors. | 333 // compile-time errors. |
| 334 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder( | 334 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0, |
| 335 null, | 335 null, "main", null, null, ProcedureKind.Method, library, -1, -1, -1); |
| 336 null, | |
| 337 0, | |
| 338 null, | |
| 339 "main", | |
| 340 null, | |
| 341 null, | |
| 342 ProcedureKind.Method, | |
| 343 library, | |
| 344 -1, | |
| 345 -1, | |
| 346 -1); | |
| 347 library.addBuilder(mainBuilder.name, mainBuilder, -1); | 336 library.addBuilder(mainBuilder.name, mainBuilder, -1); |
| 348 mainBuilder.body = new Block(new List<Statement>.from(errors.map( | 337 mainBuilder.body = new Block(new List<Statement>.from(errors.map( |
| 349 (LocatedMessage message) => new ExpressionStatement(new Throw( | 338 (LocatedMessage message) => new ExpressionStatement(new Throw( |
| 350 new StringLiteral(context.format(message, Severity.error))))))); | 339 new StringLiteral(context.format(message, Severity.error))))))); |
| 351 } | 340 } |
| 352 library.build(loader.coreLibrary); | 341 library.build(loader.coreLibrary); |
| 353 return link(<Library>[library.library]); | 342 return link(<Library>[library.library]); |
| 354 } | 343 } |
| 355 | 344 |
| 356 /// Creates a program by combining [libraries] with the libraries of | 345 /// Creates a program by combining [libraries] with the libraries of |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 659 } |
| 671 for (Constructor constructor in superclass.constructors) { | 660 for (Constructor constructor in superclass.constructors) { |
| 672 if (constructor.name.name.isEmpty) { | 661 if (constructor.name.name.isEmpty) { |
| 673 return constructor.function.requiredParameterCount == 0 | 662 return constructor.function.requiredParameterCount == 0 |
| 674 ? constructor | 663 ? constructor |
| 675 : null; | 664 : null; |
| 676 } | 665 } |
| 677 } | 666 } |
| 678 return null; | 667 return null; |
| 679 } | 668 } |
| OLD | NEW |