Chromium Code Reviews| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 KernelTarget( | 102 KernelTarget( |
| 103 this.fileSystem, DillTarget dillTarget, TranslateUri uriTranslator, | 103 this.fileSystem, DillTarget dillTarget, TranslateUri uriTranslator, |
| 104 [Map<String, Source> uriToSource]) | 104 [Map<String, Source> uriToSource]) |
| 105 : dillTarget = dillTarget, | 105 : dillTarget = dillTarget, |
| 106 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, | 106 uriToSource = uriToSource ?? CompilerContext.current.uriToSource, |
| 107 super(dillTarget.ticker, uriTranslator, dillTarget.backendTarget) { | 107 super(dillTarget.ticker, uriTranslator, dillTarget.backendTarget) { |
| 108 resetCrashReporting(); | 108 resetCrashReporting(); |
| 109 loader = createLoader(); | 109 loader = createLoader(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool get hasErrors { | |
| 113 return errors.isNotEmpty || loader.collectCompileTimeErrors().isNotEmpty; | |
| 114 } | |
| 115 | |
| 112 void addError(file, int charOffset, String message) { | 116 void addError(file, int charOffset, String message) { |
| 113 Uri uri = file is String ? Uri.parse(file) : file; | 117 Uri uri = file is String ? Uri.parse(file) : file; |
| 114 InputError error = new InputError(uri, charOffset, message); | 118 InputError error = new InputError(uri, charOffset, message); |
| 115 String formatterMessage = error.format(); | 119 String formatterMessage = error.format(); |
| 116 print(formatterMessage); | 120 print(formatterMessage); |
| 117 errors.add(formatterMessage); | 121 errors.add(formatterMessage); |
| 118 } | 122 } |
| 119 | 123 |
| 120 SourceLoader<Library> createLoader() => | 124 SourceLoader<Library> createLoader() => |
| 121 new SourceLoader<Library>(fileSystem, this); | 125 new SourceLoader<Library>(fileSystem, this); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 handleInputError(null, | 278 handleInputError(null, |
| 275 isFullProgram: true, trimDependencies: trimDependencies); | 279 isFullProgram: true, trimDependencies: trimDependencies); |
| 276 return program; | 280 return program; |
| 277 } | 281 } |
| 278 | 282 |
| 279 try { | 283 try { |
| 280 await loader.buildBodies(); | 284 await loader.buildBodies(); |
| 281 loader.finishStaticInvocations(); | 285 loader.finishStaticInvocations(); |
| 282 finishAllConstructors(); | 286 finishAllConstructors(); |
| 283 loader.finishNativeMethods(); | 287 loader.finishNativeMethods(); |
| 284 runBuildTransformations(); | 288 if (!hasErrors) { |
| 289 runBuildTransformations(); | |
|
ahe
2017/06/09 08:13:14
The parser reports a recoverable error on code lik
| |
| 290 } | |
| 285 | 291 |
| 286 if (verify) this.verify(); | 292 if (verify) this.verify(); |
| 287 errors.addAll(loader.collectCompileTimeErrors().map((e) => e.format())); | 293 errors.addAll(loader.collectCompileTimeErrors().map((e) => e.format())); |
| 288 if (errors.isNotEmpty) { | 294 if (errors.isNotEmpty) { |
| 289 handleInputError(null, | 295 handleInputError(null, |
| 290 isFullProgram: true, trimDependencies: trimDependencies); | 296 isFullProgram: true, trimDependencies: trimDependencies); |
| 291 } | 297 } |
| 292 } on InputError catch (e) { | 298 } on InputError catch (e) { |
| 293 handleInputError(e, | 299 handleInputError(e, |
| 294 isFullProgram: true, trimDependencies: trimDependencies); | 300 isFullProgram: true, trimDependencies: trimDependencies); |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 } | 706 } |
| 701 for (Constructor constructor in superclass.constructors) { | 707 for (Constructor constructor in superclass.constructors) { |
| 702 if (constructor.name.name.isEmpty) { | 708 if (constructor.name.name.isEmpty) { |
| 703 return constructor.function.requiredParameterCount == 0 | 709 return constructor.function.requiredParameterCount == 0 |
| 704 ? constructor | 710 ? constructor |
| 705 : null; | 711 : null; |
| 706 } | 712 } |
| 707 } | 713 } |
| 708 return null; | 714 return null; |
| 709 } | 715 } |
| OLD | NEW |