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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/apiimpl.dart

Issue 18125004: Don't request bug reports when aborting due to --throw-on-error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/dart2js.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 leg_apiimpl; 5 library leg_apiimpl;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import '../compiler.dart' as api; 9 import '../compiler.dart' as api;
10 import 'dart2jslib.dart' as leg; 10 import 'dart2jslib.dart' as leg;
11 import 'tree/tree.dart' as tree; 11 import 'tree/tree.dart' as tree;
12 import 'elements/elements.dart' as elements; 12 import 'elements/elements.dart' as elements;
13 import 'ssa/tracer.dart' as ssa; 13 import 'ssa/tracer.dart' as ssa;
14 import '../../libraries.dart'; 14 import '../../libraries.dart';
15 import 'source_file.dart'; 15 import 'source_file.dart';
16 16
17 class Compiler extends leg.Compiler { 17 class Compiler extends leg.Compiler {
18 api.ReadStringFromUri provider; 18 api.ReadStringFromUri provider;
19 api.DiagnosticHandler handler; 19 api.DiagnosticHandler handler;
20 final Uri libraryRoot; 20 final Uri libraryRoot;
21 final Uri packageRoot; 21 final Uri packageRoot;
22 List<String> options; 22 List<String> options;
23 bool mockableLibraryUsed = false; 23 bool mockableLibraryUsed = false;
24 final Set<String> allowedLibraryCategories; 24 final Set<String> allowedLibraryCategories;
25 final bool throwOnError;
25 26
26 Compiler(this.provider, 27 Compiler(this.provider,
27 api.CompilerOutputProvider outputProvider, 28 api.CompilerOutputProvider outputProvider,
28 this.handler, 29 this.handler,
29 this.libraryRoot, 30 this.libraryRoot,
30 this.packageRoot, 31 this.packageRoot,
31 List<String> options) 32 List<String> options)
32 : this.options = options, 33 : this.options = options,
33 this.allowedLibraryCategories = getAllowedLibraryCategories(options), 34 this.allowedLibraryCategories = getAllowedLibraryCategories(options),
35 this.throwOnError = hasOption(options, '--throw-on-error'),
34 super( 36 super(
35 tracer: new ssa.HTracer( 37 tracer: new ssa.HTracer(
36 ssa.GENERATE_SSA_TRACE ? outputProvider('dart', 'cfg') : null), 38 ssa.GENERATE_SSA_TRACE ? outputProvider('dart', 'cfg') : null),
37 outputProvider: outputProvider, 39 outputProvider: outputProvider,
38 enableTypeAssertions: hasOption(options, '--enable-checked-mode'), 40 enableTypeAssertions: hasOption(options, '--enable-checked-mode'),
39 enableUserAssertions: hasOption(options, '--enable-checked-mode'), 41 enableUserAssertions: hasOption(options, '--enable-checked-mode'),
40 trustTypeAnnotations: 42 trustTypeAnnotations:
41 hasOption(options, '--trust-type-annotations'), 43 hasOption(options, '--trust-type-annotations'),
42 enableMinification: hasOption(options, '--minify'), 44 enableMinification: hasOption(options, '--minify'),
43 enableNativeLiveTypeAnalysis: 45 enableNativeLiveTypeAnalysis:
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 if (node != null && importingLibrary != null) { 223 if (node != null && importingLibrary != null) {
222 reportDiagnostic(spanFromNode(node), 224 reportDiagnostic(spanFromNode(node),
223 'Error: Internal library $resolvedUri is not accessible from ' 225 'Error: Internal library $resolvedUri is not accessible from '
224 '${importingLibrary.canonicalUri}.', 226 '${importingLibrary.canonicalUri}.',
225 api.Diagnostic.ERROR); 227 api.Diagnostic.ERROR);
226 } else { 228 } else {
227 reportDiagnostic(null, 229 reportDiagnostic(null,
228 'Error: Internal library $resolvedUri is not accessible.', 230 'Error: Internal library $resolvedUri is not accessible.',
229 api.Diagnostic.ERROR); 231 api.Diagnostic.ERROR);
230 } 232 }
231 //path = null; 233 //path = null;
kasperl 2013/06/28 10:26:50 Should we get rid of this line?
232 } 234 }
233 } 235 }
234 if (path == null) { 236 if (path == null) {
235 if (node != null) { 237 if (node != null) {
236 reportError(node, 'library not found ${resolvedUri}'); 238 reportError(node, 'library not found ${resolvedUri}');
237 } else { 239 } else {
238 reportDiagnostic(null, 'library not found ${resolvedUri}', 240 reportDiagnostic(null, 'library not found ${resolvedUri}',
239 api.Diagnostic.ERROR); 241 api.Diagnostic.ERROR);
240 } 242 }
241 return null; 243 return null;
(...skipping 24 matching lines...) Expand all
266 log('${task.name} took ${task.timing}msec'); 268 log('${task.name} took ${task.timing}msec');
267 } 269 }
268 int total = totalCompileTime.elapsedMilliseconds; 270 int total = totalCompileTime.elapsedMilliseconds;
269 log('Total compile-time ${total}msec;' 271 log('Total compile-time ${total}msec;'
270 ' unaccounted ${total - cumulated}msec'); 272 ' unaccounted ${total - cumulated}msec');
271 return success; 273 return success;
272 } 274 }
273 275
274 void reportDiagnostic(leg.SourceSpan span, String message, 276 void reportDiagnostic(leg.SourceSpan span, String message,
275 api.Diagnostic kind) { 277 api.Diagnostic kind) {
278 bool isFatal = false;
276 if (identical(kind, api.Diagnostic.ERROR) 279 if (identical(kind, api.Diagnostic.ERROR)
277 || identical(kind, api.Diagnostic.CRASH)) { 280 || identical(kind, api.Diagnostic.CRASH)) {
278 compilationFailed = true; 281 compilationFailed = true;
282 isFatal = true;
279 } 283 }
280 // [:span.uri:] might be [:null:] in case of a [Script] with no [uri]. For 284 // [:span.uri:] might be [:null:] in case of a [Script] with no [uri]. For
281 // instance in the [Types] constructor in typechecker.dart. 285 // instance in the [Types] constructor in typechecker.dart.
282 if (span == null || span.uri == null) { 286 if (span == null || span.uri == null) {
283 handler(null, null, null, message, kind); 287 handler(null, null, null, message, kind);
284 } else { 288 } else {
285 handler(translateUri(span.uri, null), span.begin, span.end, 289 handler(translateUri(span.uri, null), span.begin, span.end,
286 message, kind); 290 message, kind);
287 } 291 }
292 if (isFatal && throwOnError) {
293 hasCrashed = true;
kasperl 2013/06/28 10:26:50 Add a comment here? Rename flag to make it clear t
294 throw new AbortCompilation(message);
295 }
288 } 296 }
289 297
290 bool get isMockCompilation { 298 bool get isMockCompilation {
291 return mockableLibraryUsed 299 return mockableLibraryUsed
292 && (options.indexOf('--allow-mock-compilation') != -1); 300 && (options.indexOf('--allow-mock-compilation') != -1);
293 } 301 }
294 } 302 }
303
304 class AbortCompilation {
305 final message;
306 AbortCompilation(this.message);
307 toString() => 'Aborted due to --throw-on-error: $message';
308 }
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698