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

Side by Side Diff: dart/lib/compiler/implementation/compiler.dart

Issue 10575033: Implement override checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix problem that caused an assertion failure (and revert of the first attempt) Created 8 years, 6 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
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 5
6 /** 6 /**
7 * If true, print a warning for each method that was resolved, but not 7 * If true, print a warning for each method that was resolved, but not
8 * compiled. 8 * compiled.
9 */ 9 */
10 final bool REPORT_EXCESS_RESOLUTION = false; 10 final bool REPORT_EXCESS_RESOLUTION = false;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 bool enabledNoSuchMethod = false; 296 bool enabledNoSuchMethod = false;
297 297
298 Stopwatch progress; 298 Stopwatch progress;
299 299
300 static final int PHASE_SCANNING = 0; 300 static final int PHASE_SCANNING = 0;
301 static final int PHASE_RESOLVING = 1; 301 static final int PHASE_RESOLVING = 1;
302 static final int PHASE_COMPILING = 2; 302 static final int PHASE_COMPILING = 2;
303 static final int PHASE_RECOMPILING = 3; 303 static final int PHASE_RECOMPILING = 3;
304 int phase; 304 int phase;
305 305
306 bool compilationFailed = false;
307
306 Compiler([this.tracer = const Tracer(), 308 Compiler([this.tracer = const Tracer(),
307 this.enableTypeAssertions = false, 309 this.enableTypeAssertions = false,
308 this.enableUserAssertions = false, 310 this.enableUserAssertions = false,
309 bool emitJavascript = true, 311 bool emitJavascript = true,
310 validateUnparse = false, 312 validateUnparse = false,
311 generateSourceMap = true]) 313 generateSourceMap = true])
312 : libraries = new Map<String, LibraryElement>(), 314 : libraries = new Map<String, LibraryElement>(),
313 world = new World(), 315 world = new World(),
314 progress = new Stopwatch.start() { 316 progress = new Stopwatch.start() {
315 namer = new Namer(this); 317 namer = new Namer(this);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution 543 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution
542 // should know this. 544 // should know this.
543 world.populate(this, libraries.getValues()); 545 world.populate(this, libraries.getValues());
544 546
545 log('Resolving...'); 547 log('Resolving...');
546 phase = PHASE_RESOLVING; 548 phase = PHASE_RESOLVING;
547 backend.enqueueHelpers(enqueuer.resolution); 549 backend.enqueueHelpers(enqueuer.resolution);
548 processQueue(enqueuer.resolution, main); 550 processQueue(enqueuer.resolution, main);
549 log('Resolved ${enqueuer.resolution.resolvedElements.length} elements.'); 551 log('Resolved ${enqueuer.resolution.resolvedElements.length} elements.');
550 552
553 if (compilationFailed) return;
554
551 log('Compiling...'); 555 log('Compiling...');
552 phase = PHASE_COMPILING; 556 phase = PHASE_COMPILING;
553 processQueue(enqueuer.codegen, main); 557 processQueue(enqueuer.codegen, main);
554 log("Recompiling ${enqueuer.codegen.recompilationCandidates.length} " 558 log("Recompiling ${enqueuer.codegen.recompilationCandidates.length} "
555 "methods..."); 559 "methods...");
556 phase = PHASE_RECOMPILING; 560 phase = PHASE_RECOMPILING;
557 processRecompilationQueue(enqueuer.codegen); 561 processRecompilationQueue(enqueuer.codegen);
558 log('Compiled ${codegenWorld.generatedCode.length} methods.'); 562 log('Compiled ${codegenWorld.generatedCode.length} methods.');
559 563
564 if (compilationFailed) return;
565
560 backend.assembleProgram(); 566 backend.assembleProgram();
561 567
562 checkQueues(); 568 checkQueues();
563 } 569 }
564 570
565 void processQueue(Enqueuer world, Element main) { 571 void processQueue(Enqueuer world, Element main) {
566 backend.processNativeClasses(world, libraries.getValues()); 572 backend.processNativeClasses(world, libraries.getValues());
567 world.addToWorkList(main); 573 world.addToWorkList(main);
568 progress.reset(); 574 progress.reset();
569 world.forEach((WorkItem work) { 575 world.forEach((WorkItem work) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // TODO(ahe): Don't supress these warning when the type checker 754 // TODO(ahe): Don't supress these warning when the type checker
749 // is more complete. 755 // is more complete.
750 if (message.message.kind === MessageKind.NOT_ASSIGNABLE) return; 756 if (message.message.kind === MessageKind.NOT_ASSIGNABLE) return;
751 if (message.message.kind === MessageKind.MISSING_RETURN) return; 757 if (message.message.kind === MessageKind.MISSING_RETURN) return;
752 if (message.message.kind === MessageKind.MAYBE_MISSING_RETURN) return; 758 if (message.message.kind === MessageKind.MAYBE_MISSING_RETURN) return;
753 if (message.message.kind === MessageKind.ADDITIONAL_ARGUMENT) return; 759 if (message.message.kind === MessageKind.ADDITIONAL_ARGUMENT) return;
754 if (message.message.kind === MessageKind.METHOD_NOT_FOUND) return; 760 if (message.message.kind === MessageKind.METHOD_NOT_FOUND) return;
755 } 761 }
756 SourceSpan span = spanFromNode(node); 762 SourceSpan span = spanFromNode(node);
757 763
758 reportDiagnostic(span, 'Warning: $message', api.Diagnostic.WARNING ); 764 reportDiagnostic(span, 'Warning: $message', api.Diagnostic.WARNING);
759 } 765 }
760 766
761 reportError(Node node, var message) { 767 reportError(Node node, var message) {
762 SourceSpan span = spanFromNode(node); 768 SourceSpan span = spanFromNode(node);
763 reportDiagnostic(span, 'Error: $message', api.Diagnostic.ERROR); 769 reportDiagnostic(span, 'Error: $message', api.Diagnostic.ERROR);
764 throw new CompilerCancelledException(message.toString()); 770 throw new CompilerCancelledException(message.toString());
765 } 771 }
766 772
773 void reportMessage(SourceSpan span,
774 Diagnostic message,
775 api.Diagnostic kind) {
776 // TODO(ahe): The names Diagnostic and api.Diagnostic are in
777 // conflict. Fix it.
778 reportDiagnostic(span, "$message", kind);
779 }
780
767 abstract void reportDiagnostic(SourceSpan span, String message, 781 abstract void reportDiagnostic(SourceSpan span, String message,
768 api.Diagnostic kind); 782 api.Diagnostic kind);
769 783
770 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { 784 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) {
771 if (begin === null || end === null) { 785 if (begin === null || end === null) {
772 // TODO(ahe): We can almost always do better. Often it is only 786 // TODO(ahe): We can almost always do better. Often it is only
773 // end that is null. Otherwise, we probably know the current 787 // end that is null. Otherwise, we probably know the current
774 // URI. 788 // URI.
775 throw 'Cannot find tokens to produce error message.'; 789 throw 'Cannot find tokens to produce error message.';
776 } 790 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 // invariant that endOffset > beginOffset, but for EOF the 898 // invariant that endOffset > beginOffset, but for EOF the
885 // charoffset of the next token may be [beginOffset]. This can 899 // charoffset of the next token may be [beginOffset]. This can
886 // also happen for synthetized tokens that are produced during 900 // also happen for synthetized tokens that are produced during
887 // error handling. 901 // error handling.
888 final endOffset = 902 final endOffset =
889 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1); 903 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1);
890 assert(endOffset > beginOffset); 904 assert(endOffset > beginOffset);
891 return f(beginOffset, endOffset); 905 return f(beginOffset, endOffset);
892 } 906 }
893 } 907 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/apiimpl.dart ('k') | dart/lib/compiler/implementation/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698