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

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

Issue 10537129: Address review comments from https://chromiumcodereview.appspot.com/10542073/ (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/enqueue.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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 withCurrentElement(work.element, () => work.run(this, world)); 425 withCurrentElement(work.element, () => work.run(this, world));
426 }); 426 });
427 world.queueIsClosed = true; 427 world.queueIsClosed = true;
428 assert(world.checkNoEnqueuedInvokedInstanceMethods()); 428 assert(world.checkNoEnqueuedInvokedInstanceMethods());
429 world.registerFieldClosureInvocations(); 429 world.registerFieldClosureInvocations();
430 } 430 }
431 431
432 /** 432 /**
433 * Perform various checks of the queues. This includes checking that 433 * Perform various checks of the queues. This includes checking that
434 * the queues are empty (nothing was added after we stopped 434 * the queues are empty (nothing was added after we stopped
435 * processing the quese). Also compute the number of methods that 435 * processing the queues). Also compute the number of methods that
436 * were resolved, but not compiled (aka excess resolution). 436 * were resolved, but not compiled (aka excess resolution).
437 */ 437 */
438 checkQueues() { 438 checkQueues() {
439 for (var world in [enqueuer.resolution, enqueuer.codegen]) { 439 for (var world in [enqueuer.resolution, enqueuer.codegen]) {
440 world.forEach((WorkItem work) { 440 world.forEach((WorkItem work) {
441 internalErrorOnElement(work.element, "Work list is not empty."); 441 internalErrorOnElement(work.element, "Work list is not empty.");
442 }); 442 });
443 } 443 }
444 var resolved = new Set.from(enqueuer.resolution.resolvedElements.getKeys()); 444 var resolved = new Set.from(enqueuer.resolution.resolvedElements.getKeys());
445 for (Element e in codegenWorld.generatedCode.getKeys()) { 445 for (Element e in codegenWorld.generatedCode.getKeys()) {
(...skipping 25 matching lines...) Expand all
471 if (!REPORT_EXCESS_RESOLUTION) return; 471 if (!REPORT_EXCESS_RESOLUTION) return;
472 for (Element e in resolved) { 472 for (Element e in resolved) {
473 SourceSpan span = spanFromElement(e); 473 SourceSpan span = spanFromElement(e);
474 reportDiagnostic(span, 'Warning: $e resolved but not compiled.', false); 474 reportDiagnostic(span, 'Warning: $e resolved but not compiled.', false);
475 } 475 }
476 } 476 }
477 477
478 TreeElements analyzeElement(Element element) { 478 TreeElements analyzeElement(Element element) {
479 TreeElements elements = enqueuer.resolution.getCachedElements(element); 479 TreeElements elements = enqueuer.resolution.getCachedElements(element);
480 if (elements !== null) return elements; 480 if (elements !== null) return elements;
481 if (element is AbstractFieldElement) {
482 return null;
483 }
484 final int allowed = ElementCategory.VARIABLE | ElementCategory.FUNCTION 481 final int allowed = ElementCategory.VARIABLE | ElementCategory.FUNCTION
485 | ElementCategory.FACTORY; 482 | ElementCategory.FACTORY;
486 if (!element.isAccessor() && (element.kind.category & allowed) == 0) { 483 ElementKind kind = element.kind;
484 if (!element.isAccessor() &&
485 ((kind === ElementKind.ABSTRACT_FIELD) ||
486 (kind.category & allowed) == 0)) {
487 return null; 487 return null;
488 } 488 }
489 assert(parser !== null); 489 assert(parser !== null);
490 Node tree = parser.parse(element); 490 Node tree = parser.parse(element);
491 validator.validate(tree); 491 validator.validate(tree);
492 unparseValidator.check(element); 492 unparseValidator.check(element);
493 elements = resolver.resolve(element); 493 elements = resolver.resolve(element);
494 checker.check(tree, elements); 494 checker.check(tree, elements);
495 return elements; 495 return elements;
496 } 496 }
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 // invariant that endOffset > beginOffset, but for EOF the 701 // invariant that endOffset > beginOffset, but for EOF the
702 // charoffset of the next token may be [beginOffset]. This can 702 // charoffset of the next token may be [beginOffset]. This can
703 // also happen for synthetized tokens that are produced during 703 // also happen for synthetized tokens that are produced during
704 // error handling. 704 // error handling.
705 final endOffset = 705 final endOffset =
706 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1); 706 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1);
707 assert(endOffset > beginOffset); 707 assert(endOffset > beginOffset);
708 return f(beginOffset, endOffset); 708 return f(beginOffset, endOffset);
709 } 709 }
710 } 710 }
OLDNEW
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698