Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/compiler.dart

Issue 2883443002: Better error when force-compile fails (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/command.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:collection' show HashSet, Queue; 5 import 'dart:collection' show HashSet, Queue;
6 import 'dart:convert' show JSON; 6 import 'dart:convert' show JSON;
7 import 'dart:io' show File; 7 import 'dart:io' show File;
8 8
9 import 'package:analyzer/analyzer.dart' 9 import 'package:analyzer/analyzer.dart'
10 show AnalysisError, CompilationUnit, ErrorSeverity; 10 show AnalysisError, CompilationUnit, ErrorSeverity;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 var messages = <String>[]; 208 var messages = <String>[];
209 for (var e in errors) { 209 for (var e in errors) {
210 var m = formatError(context, e); 210 var m = formatError(context, e);
211 if (m != null) messages.add(m); 211 if (m != null) messages.add(m);
212 } 212 }
213 213
214 if (!options.unsafeForceCompile && 214 if (!options.unsafeForceCompile &&
215 errors.any((e) => _isFatalError(e, options))) { 215 errors.any((e) => _isFatalError(e, options))) {
216 return new JSModuleFile.invalid(unit.name, messages, options); 216 return new JSModuleFile.invalid(unit.name, messages, options);
217 } 217 }
218 var codeGenerator = 218
219 new CodeGenerator(context, summaryData, options, _extensionTypes); 219 try {
220 return codeGenerator.compile(unit, trees, messages); 220 var codeGenerator =
221 new CodeGenerator(context, summaryData, options, _extensionTypes);
222 return codeGenerator.compile(unit, trees, messages);
223 } catch (e) {
224 if (errors.any((e) => _isFatalError(e, options))) {
225 // Force compilation failed. Suppress the exception and report
226 // the static errors instead.
227 assert(options.unsafeForceCompile);
228 return new JSModuleFile.invalid(unit.name, messages, options);
229 }
230 rethrow;
231 }
221 } 232 }
222 } 233 }
223 234
224 class CompilerOptions { 235 class CompilerOptions {
225 /// Whether to emit the source mapping file. 236 /// Whether to emit the source mapping file.
226 /// 237 ///
227 /// This supports debugging the original source code instead of the generated 238 /// This supports debugging the original source code instead of the generated
228 /// code. 239 /// code.
229 final bool sourceMap; 240 final bool sourceMap;
230 241
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 case "dart": 636 case "dart":
626 case "package": 637 case "package":
627 case "file": 638 case "file":
628 // A valid URI. 639 // A valid URI.
629 return uri; 640 return uri;
630 default: 641 default:
631 // Assume a file path. 642 // Assume a file path.
632 return new Uri.file(path.absolute(source)); 643 return new Uri.file(path.absolute(source));
633 } 644 }
634 } 645 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/command.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698