| 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; | 9 import 'dart:io' show File; |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 void addSourceInformation( | 130 void addSourceInformation( |
| 131 Uri uri, List<int> lineStarts, List<int> sourceCode) { | 131 Uri uri, List<int> lineStarts, List<int> sourceCode) { |
| 132 String fileUri = relativizeUri(uri); | 132 String fileUri = relativizeUri(uri); |
| 133 uriToSource[fileUri] = new Source(lineStarts, sourceCode); | 133 uriToSource[fileUri] = new Source(lineStarts, sourceCode); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void read(Uri uri) { | 136 void read(Uri uri) { |
| 137 loader.read(uri, -1); | 137 loader.read(uri, -1); |
| 138 } | 138 } |
| 139 | 139 |
| 140 LibraryBuilder createLibraryBuilder(Uri uri, Uri fileUri) { | 140 LibraryBuilder createLibraryBuilder(Uri uri, Uri fileUri, bool isPatch) { |
| 141 if (dillTarget.isLoaded) { | 141 if (dillTarget.isLoaded) { |
| 142 var builder = dillTarget.loader.builders[uri]; | 142 var builder = dillTarget.loader.builders[uri]; |
| 143 if (builder != null) { | 143 if (builder != null) { |
| 144 return builder; | 144 return builder; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 return new KernelLibraryBuilder(uri, fileUri, loader); | 147 return new KernelLibraryBuilder(uri, fileUri, loader, isPatch); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void forEachDirectSupertype(ClassBuilder cls, void f(NamedTypeBuilder type)) { | 150 void forEachDirectSupertype(ClassBuilder cls, void f(NamedTypeBuilder type)) { |
| 151 TypeBuilder supertype = cls.supertype; | 151 TypeBuilder supertype = cls.supertype; |
| 152 if (supertype is NamedTypeBuilder) { | 152 if (supertype is NamedTypeBuilder) { |
| 153 f(supertype); | 153 f(supertype); |
| 154 } else if (supertype != null) { | 154 } else if (supertype != null) { |
| 155 internalError("Unhandled: ${supertype.runtimeType}"); | 155 internalError("Unhandled: ${supertype.runtimeType}"); |
| 156 } | 156 } |
| 157 if (cls.interfaces != null) { | 157 if (cls.interfaces != null) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 348 } |
| 349 sb.writeln(); | 349 sb.writeln(); |
| 350 await new File.fromUri(depsFile).writeAsString("$sb"); | 350 await new File.fromUri(depsFile).writeAsString("$sb"); |
| 351 ticker.logMs("Wrote deps file"); | 351 ticker.logMs("Wrote deps file"); |
| 352 } | 352 } |
| 353 | 353 |
| 354 Program erroneousProgram(bool isFullProgram) { | 354 Program erroneousProgram(bool isFullProgram) { |
| 355 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); | 355 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); |
| 356 Uri fileUri = loader.first?.fileUri ?? uri; | 356 Uri fileUri = loader.first?.fileUri ?? uri; |
| 357 KernelLibraryBuilder library = | 357 KernelLibraryBuilder library = |
| 358 new KernelLibraryBuilder(uri, fileUri, loader); | 358 new KernelLibraryBuilder(uri, fileUri, loader, false); |
| 359 loader.first = library; | 359 loader.first = library; |
| 360 if (isFullProgram) { | 360 if (isFullProgram) { |
| 361 // If this is an outline, we shouldn't add an executable main | 361 // If this is an outline, we shouldn't add an executable main |
| 362 // method. Similarly considerations apply to separate compilation. It | 362 // method. Similarly considerations apply to separate compilation. It |
| 363 // could also make sense to add a way to mark .dill files as having | 363 // could also make sense to add a way to mark .dill files as having |
| 364 // compile-time errors. | 364 // compile-time errors. |
| 365 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0, | 365 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0, |
| 366 null, "main", null, null, ProcedureKind.Method, library, -1, -1, -1); | 366 null, "main", null, null, ProcedureKind.Method, library, -1, -1, -1); |
| 367 library.addBuilder(mainBuilder.name, mainBuilder, -1); | 367 library.addBuilder(mainBuilder.name, mainBuilder, -1); |
| 368 mainBuilder.body = new ExpressionStatement( | 368 mainBuilder.body = new ExpressionStatement( |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 } | 722 } |
| 723 for (Constructor constructor in superclass.constructors) { | 723 for (Constructor constructor in superclass.constructors) { |
| 724 if (constructor.name.name.isEmpty) { | 724 if (constructor.name.name.isEmpty) { |
| 725 return constructor.function.requiredParameterCount == 0 | 725 return constructor.function.requiredParameterCount == 0 |
| 726 ? constructor | 726 ? constructor |
| 727 : null; | 727 : null; |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 return null; | 730 return null; |
| 731 } | 731 } |
| OLD | NEW |