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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 11293244: Implement --analyze-all option. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Correctly parse metadata Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: dart/sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
index f97d3d9c8729085597dead1feeeafbfc71254cb1..9ad691915fc523da02190f61526daf5feb89bc69 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -103,6 +103,7 @@ abstract class Compiler implements DiagnosticListener {
final bool enableTypeAssertions;
final bool enableUserAssertions;
final bool enableConcreteTypeInference;
+ final bool analyzeAll;
bool disableInlining = false;
@@ -213,6 +214,7 @@ abstract class Compiler implements DiagnosticListener {
bool emitJavaScript: true,
bool generateSourceMap: true,
bool disallowUnsafeEval: false,
+ this.analyzeAll: false,
List<String> strips: const []})
: libraries = new Map<String, LibraryElement>(),
progress = new Stopwatch() {
@@ -517,6 +519,7 @@ abstract class Compiler implements DiagnosticListener {
log('Resolving...');
phase = PHASE_RESOLVING;
+ if (analyzeAll) libraries.forEach((_, lib) => fullyEnqueueLibrary(lib));
backend.enqueueHelpers(enqueuer.resolution);
processQueue(enqueuer.resolution, main);
log('Resolved ${enqueuer.resolution.resolvedElements.length} elements.');
@@ -542,6 +545,22 @@ abstract class Compiler implements DiagnosticListener {
checkQueues();
}
+ void fullyEnqueueLibrary(LibraryElement library) {
+ library.forEachLocalMember(fullyEnqueueTopLevelElement);
+ }
+
+ void fullyEnqueueTopLevelElement(Element element) {
+ if (element.isClass()) {
+ ClassElement cls = element;
+ cls.ensureResolved(this);
+ for (Element member in cls.localMembers) {
+ enqueuer.resolution.addToWorkList(member);
+ }
+ } else {
+ enqueuer.resolution.addToWorkList(element);
+ }
+ }
+
void processQueue(Enqueuer world, Element main) {
backend.processNativeClasses(world, libraries.values);
world.addToWorkList(main);
@@ -609,14 +628,6 @@ abstract class Compiler implements DiagnosticListener {
assert(invariant(element, element.isDeclaration));
TreeElements elements = enqueuer.resolution.getCachedElements(element);
if (elements != null) return elements;
- final int allowed = ElementCategory.VARIABLE | ElementCategory.FUNCTION
- | ElementCategory.FACTORY;
- ElementKind kind = element.kind;
- if (!element.isAccessor() &&
- ((identical(kind, ElementKind.ABSTRACT_FIELD)) ||
- (kind.category & allowed) == 0)) {
- return null;
- }
assert(parser != null);
Node tree = parser.parse(element);
validator.validate(tree);

Powered by Google App Engine
This is Rietveld 408576698