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

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

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

Powered by Google App Engine
This is Rietveld 408576698