| 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 | 7 import 'dart:async' show |
| 8 Future; | 8 Future; |
| 9 | 9 |
| 10 import 'dart:io' show | 10 import 'dart:io' show |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 }); | 189 }); |
| 190 return result; | 190 return result; |
| 191 } | 191 } |
| 192 | 192 |
| 193 void breakCycle(ClassBuilder builder) { | 193 void breakCycle(ClassBuilder builder) { |
| 194 Class cls = builder.target; | 194 Class cls = builder.target; |
| 195 cls.implementedTypes.clear(); | 195 cls.implementedTypes.clear(); |
| 196 cls.supertype = null; | 196 cls.supertype = null; |
| 197 cls.mixedInType = null; | 197 cls.mixedInType = null; |
| 198 builder.supertype = new KernelNamedTypeBuilder("Object", null) | 198 builder.supertype = |
| 199 new KernelNamedTypeBuilder( |
| 200 "Object", null, builder.charOffset, |
| 201 builder.fileUri ?? Uri.parse(cls.fileUri)) |
| 199 ..builder = objectClassBuilder; | 202 ..builder = objectClassBuilder; |
| 200 builder.interfaces = null; | 203 builder.interfaces = null; |
| 201 } | 204 } |
| 202 | 205 |
| 203 Future<Program> handleInputError(Uri uri, InputError error, | 206 Future<Program> handleInputError(Uri uri, InputError error, |
| 204 {bool isFullProgram}) { | 207 {bool isFullProgram}) { |
| 205 if (error != null) { | 208 if (error != null) { |
| 206 String message = error.format(); | 209 String message = error.format(); |
| 207 print(message); | 210 print(message); |
| 208 errors.add(message); | 211 errors.add(message); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 Uri fileUri = loader.first?.fileUri ?? uri; | 273 Uri fileUri = loader.first?.fileUri ?? uri; |
| 271 KernelLibraryBuilder library = | 274 KernelLibraryBuilder library = |
| 272 new KernelLibraryBuilder(uri, fileUri, loader); | 275 new KernelLibraryBuilder(uri, fileUri, loader); |
| 273 loader.first = library; | 276 loader.first = library; |
| 274 if (isFullProgram) { | 277 if (isFullProgram) { |
| 275 // If this is an outline, we shouldn't add an executable main | 278 // If this is an outline, we shouldn't add an executable main |
| 276 // method. Similarly considerations apply to separate compilation. It | 279 // method. Similarly considerations apply to separate compilation. It |
| 277 // could also make sense to add a way to mark .dill files as having | 280 // could also make sense to add a way to mark .dill files as having |
| 278 // compile-time errors. | 281 // compile-time errors. |
| 279 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0, | 282 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(null, 0, |
| 280 null, "main", null, null, AsyncMarker.Sync, ProcedureKind.Method); | 283 null, "main", null, null, AsyncMarker.Sync, ProcedureKind.Method, |
| 284 library, -1); |
| 281 library.addBuilder(mainBuilder.name, mainBuilder); | 285 library.addBuilder(mainBuilder.name, mainBuilder); |
| 282 mainBuilder.body = new ExpressionStatement( | 286 mainBuilder.body = new ExpressionStatement( |
| 283 new Throw(new StringLiteral("${errors.join('\n')}"))); | 287 new Throw(new StringLiteral("${errors.join('\n')}"))); |
| 284 } | 288 } |
| 285 library.build(); | 289 library.build(); |
| 286 return link(<Library>[library.library]); | 290 return link(<Library>[library.library]); |
| 287 } | 291 } |
| 288 | 292 |
| 289 /// Creates a program by combining [libraries] with the libraries of | 293 /// Creates a program by combining [libraries] with the libraries of |
| 290 /// `dillTarget.loader.program`. | 294 /// `dillTarget.loader.program`. |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 superclass = superclass.superclass; | 591 superclass = superclass.superclass; |
| 588 } | 592 } |
| 589 for (Constructor constructor in superclass.constructors) { | 593 for (Constructor constructor in superclass.constructors) { |
| 590 if (constructor.name.name.isEmpty) { | 594 if (constructor.name.name.isEmpty) { |
| 591 return constructor.function.requiredParameterCount == 0 ? | 595 return constructor.function.requiredParameterCount == 0 ? |
| 592 constructor : null; | 596 constructor : null; |
| 593 } | 597 } |
| 594 } | 598 } |
| 595 return null; | 599 return null; |
| 596 } | 600 } |
| OLD | NEW |