OLD | NEW |
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 dart2js.compiler_base; | 5 library dart2js.compiler_base; |
6 | 6 |
7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show EventSink, Future; |
8 | 8 |
9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
10 import 'cache_strategy.dart' show CacheStrategy; | 10 import 'cache_strategy.dart' show CacheStrategy; |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 * processing the queues). Also compute the number of methods that | 901 * processing the queues). Also compute the number of methods that |
902 * were resolved, but not compiled (aka excess resolution). | 902 * were resolved, but not compiled (aka excess resolution). |
903 */ | 903 */ |
904 checkQueues() { | 904 checkQueues() { |
905 for (Enqueuer world in [enqueuer.resolution, enqueuer.codegen]) { | 905 for (Enqueuer world in [enqueuer.resolution, enqueuer.codegen]) { |
906 world.forEach((WorkItem work) { | 906 world.forEach((WorkItem work) { |
907 reporter.internalError(work.element, "Work list is not empty."); | 907 reporter.internalError(work.element, "Work list is not empty."); |
908 }); | 908 }); |
909 } | 909 } |
910 if (!REPORT_EXCESS_RESOLUTION) return; | 910 if (!REPORT_EXCESS_RESOLUTION) return; |
911 var resolved = new Set.from(enqueuer.resolution.processedElements); | 911 var resolved = new Set.from(enqueuer.resolution.processedEntities); |
912 for (Element e in enqueuer.codegen.processedEntities) { | 912 for (Element e in enqueuer.codegen.processedEntities) { |
913 resolved.remove(e); | 913 resolved.remove(e); |
914 } | 914 } |
915 for (Element e in new Set.from(resolved)) { | 915 for (Element e in new Set.from(resolved)) { |
916 if (e.isClass || | 916 if (e.isClass || |
917 e.isField || | 917 e.isField || |
918 e.isTypeVariable || | 918 e.isTypeVariable || |
919 e.isTypedef || | 919 e.isTypedef || |
920 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { | 920 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { |
921 resolved.remove(e); | 921 resolved.remove(e); |
(...skipping 10 matching lines...) Expand all Loading... |
932 reporter.reportWarningMessage(e, MessageKind.GENERIC, | 932 reporter.reportWarningMessage(e, MessageKind.GENERIC, |
933 {'text': 'Warning: $e resolved but not compiled.'}); | 933 {'text': 'Warning: $e resolved but not compiled.'}); |
934 } | 934 } |
935 } | 935 } |
936 | 936 |
937 void showResolutionProgress() { | 937 void showResolutionProgress() { |
938 if (shouldPrintProgress) { | 938 if (shouldPrintProgress) { |
939 // TODO(ahe): Add structured diagnostics to the compiler API and | 939 // TODO(ahe): Add structured diagnostics to the compiler API and |
940 // use it to separate this from the --verbose option. | 940 // use it to separate this from the --verbose option. |
941 assert(phase == PHASE_RESOLVING); | 941 assert(phase == PHASE_RESOLVING); |
942 reporter.log('Resolved ${enqueuer.resolution.processedElements.length} ' | 942 reporter.log('Resolved ${enqueuer.resolution.processedEntities.length} ' |
943 'elements.'); | 943 'elements.'); |
944 progress.reset(); | 944 progress.reset(); |
945 } | 945 } |
946 } | 946 } |
947 | 947 |
948 void showCodegenProgress() { | 948 void showCodegenProgress() { |
949 if (shouldPrintProgress) { | 949 if (shouldPrintProgress) { |
950 // TODO(ahe): Add structured diagnostics to the compiler API and | 950 // TODO(ahe): Add structured diagnostics to the compiler API and |
951 // use it to separate this from the --verbose option. | 951 // use it to separate this from the --verbose option. |
952 reporter.log( | 952 reporter.log( |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 if (slashPos != -1) { | 1106 if (slashPos != -1) { |
1107 String packageName = libraryUri.path.substring(0, slashPos); | 1107 String packageName = libraryUri.path.substring(0, slashPos); |
1108 return new Uri(scheme: 'package', path: packageName); | 1108 return new Uri(scheme: 'package', path: packageName); |
1109 } | 1109 } |
1110 } | 1110 } |
1111 return libraryUri; | 1111 return libraryUri; |
1112 } | 1112 } |
1113 | 1113 |
1114 void forgetElement(Element element) { | 1114 void forgetElement(Element element) { |
1115 resolution.forgetElement(element); | 1115 resolution.forgetElement(element); |
1116 enqueuer.forgetElement(element); | 1116 enqueuer.forgetEntity(element); |
1117 if (element is MemberElement) { | 1117 if (element is MemberElement) { |
1118 for (Element closure in element.nestedClosures) { | 1118 for (Element closure in element.nestedClosures) { |
1119 // TODO(ahe): It would be nice to reuse names of nested closures. | 1119 // TODO(ahe): It would be nice to reuse names of nested closures. |
1120 closureToClassMapper.forgetElement(closure); | 1120 closureToClassMapper.forgetElement(closure); |
1121 } | 1121 } |
1122 } | 1122 } |
1123 backend.forgetElement(element); | 1123 backend.forgetElement(element); |
1124 } | 1124 } |
1125 | 1125 |
1126 /// Returns [true] if a compile-time error has been reported for element. | 1126 /// Returns [true] if a compile-time error has been reported for element. |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 _ElementScanner(this.scanner); | 2248 _ElementScanner(this.scanner); |
2249 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 2249 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
2250 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 2250 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
2251 } | 2251 } |
2252 | 2252 |
2253 class _EmptyEnvironment implements Environment { | 2253 class _EmptyEnvironment implements Environment { |
2254 const _EmptyEnvironment(); | 2254 const _EmptyEnvironment(); |
2255 | 2255 |
2256 String valueOf(String key) => null; | 2256 String valueOf(String key) => null; |
2257 } | 2257 } |
OLD | NEW |