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

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

Issue 11052011: Fix some warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 const bool REPORT_EXCESS_RESOLUTION = false; 10 const bool REPORT_EXCESS_RESOLUTION = false;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 bool isAnalyzed() => resolutionTree !== null; 50 bool isAnalyzed() => resolutionTree !== null;
51 51
52 void run(Compiler compiler, Enqueuer world) { 52 void run(Compiler compiler, Enqueuer world) {
53 CodeBuffer codeBuffer = world.universe.generatedCode[element]; 53 CodeBuffer codeBuffer = world.universe.generatedCode[element];
54 if (codeBuffer !== null) return; 54 if (codeBuffer !== null) return;
55 resolutionTree = compiler.analyze(this, world); 55 resolutionTree = compiler.analyze(this, world);
56 compiler.codegen(this, world); 56 compiler.codegen(this, world);
57 } 57 }
58 } 58 }
59 59
60 class Backend { 60 abstract class Backend {
61 final Compiler compiler; 61 final Compiler compiler;
62 final ConstantSystem constantSystem; 62 final ConstantSystem constantSystem;
63 63
64 Backend(this.compiler, 64 Backend(this.compiler,
65 [ConstantSystem constantSystem = DART_CONSTANT_SYSTEM]) 65 [ConstantSystem constantSystem = DART_CONSTANT_SYSTEM])
66 : this.constantSystem = constantSystem; 66 : this.constantSystem = constantSystem;
67 67
68 void enqueueAllTopLevelFunctions(LibraryElement lib, Enqueuer world) { 68 void enqueueAllTopLevelFunctions(LibraryElement lib, Enqueuer world) {
69 lib.forEachExport((Element e) { 69 lib.forEachExport((Element e) {
70 if (e.isFunction()) world.addToWorkList(e); 70 if (e.isFunction()) world.addToWorkList(e);
71 }); 71 });
72 } 72 }
73 73
74 abstract void enqueueHelpers(Enqueuer world); 74 abstract void enqueueHelpers(Enqueuer world);
75 abstract void codegen(WorkItem work); 75 abstract void codegen(WorkItem work);
76 abstract void processNativeClasses(Enqueuer world, 76 abstract void processNativeClasses(Enqueuer world,
77 Collection<LibraryElement> libraries); 77 Collection<LibraryElement> libraries);
78 abstract void assembleProgram(); 78 abstract void assembleProgram();
79 abstract List<CompilerTask> get tasks; 79 abstract List<CompilerTask> get tasks;
80 80
81 // TODO(ahe,karlklose): rename this?
82 void dumpInferredTypes() {}
83
81 ItemCompilationContext createItemCompilationContext() { 84 ItemCompilationContext createItemCompilationContext() {
82 return new ItemCompilationContext(); 85 return new ItemCompilationContext();
83 } 86 }
84 87
85 SourceString getCheckedModeHelper(DartType type) => null; 88 SourceString getCheckedModeHelper(DartType type) => null;
86 } 89 }
87 90
88 class Compiler implements DiagnosticListener { 91 abstract class Compiler implements DiagnosticListener {
89 final Map<String, LibraryElement> libraries; 92 final Map<String, LibraryElement> libraries;
90 int nextFreeClassId = 0; 93 int nextFreeClassId = 0;
91 World world; 94 World world;
92 String assembledCode; 95 String assembledCode;
93 Types types; 96 Types types;
94 97
95 final bool enableMinification; 98 final bool enableMinification;
96 final bool enableTypeAssertions; 99 final bool enableTypeAssertions;
97 final bool enableUserAssertions; 100 final bool enableUserAssertions;
98 101
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 backend.processNativeClasses(world, libraries.getValues()); 588 backend.processNativeClasses(world, libraries.getValues());
586 world.addToWorkList(main); 589 world.addToWorkList(main);
587 progress.reset(); 590 progress.reset();
588 world.forEach((WorkItem work) { 591 world.forEach((WorkItem work) {
589 withCurrentElement(work.element, () => work.run(this, world)); 592 withCurrentElement(work.element, () => work.run(this, world));
590 }); 593 });
591 world.queueIsClosed = true; 594 world.queueIsClosed = true;
592 if (compilationFailed) return; 595 if (compilationFailed) return;
593 assert(world.checkNoEnqueuedInvokedInstanceMethods()); 596 assert(world.checkNoEnqueuedInvokedInstanceMethods());
594 if (DUMP_INFERRED_TYPES && phase == PHASE_COMPILING) { 597 if (DUMP_INFERRED_TYPES && phase == PHASE_COMPILING) {
595 print("Inferred argument types:"); 598 backend.dumpInferredTypes();
596 print("------------------------");
597 backend.argumentTypes.dump();
598 print("");
599 print("Inferred return types:");
600 print("----------------------");
601 backend.dumpReturnTypes();
602 print("");
603 print("Inferred field types:");
604 print("------------------------");
605 backend.fieldTypes.dump();
606 print("");
607 } 599 }
608 } 600 }
609 601
610 /** 602 /**
611 * Perform various checks of the queues. This includes checking that 603 * Perform various checks of the queues. This includes checking that
612 * the queues are empty (nothing was added after we stopped 604 * the queues are empty (nothing was added after we stopped
613 * processing the queues). Also compute the number of methods that 605 * processing the queues). Also compute the number of methods that
614 * were resolved, but not compiled (aka excess resolution). 606 * were resolved, but not compiled (aka excess resolution).
615 */ 607 */
616 checkQueues() { 608 checkQueues() {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 * information in the generated error message. 943 * information in the generated error message.
952 */ 944 */
953 bool invariant(Spannable spannable, var condition, {String message: null}) { 945 bool invariant(Spannable spannable, var condition, {String message: null}) {
954 // TODO(johnniwinther): Use [spannable] and [message] to provide better 946 // TODO(johnniwinther): Use [spannable] and [message] to provide better
955 // information on assertion errors. 947 // information on assertion errors.
956 if (condition is Function){ 948 if (condition is Function){
957 condition = condition(); 949 condition = condition();
958 } 950 }
959 return spannable != null && condition; 951 return spannable != null && condition;
960 } 952 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/constants.dart » ('j') | lib/compiler/implementation/dart_backend/backend.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698