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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 1305863011: Improve strong-mode implementation and fix several failing tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 engine; 5 library engine;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:math' as math; 9 import 'dart:math' as math;
10 10
(...skipping 8397 matching lines...) Expand 10 before | Expand all | Expand 10 after
8408 DartEntry dartEntry = sourceEntry; 8408 DartEntry dartEntry = sourceEntry;
8409 if (astIsNeeded(dartEntry)) { 8409 if (astIsNeeded(dartEntry)) {
8410 return RetentionPriority.MEDIUM; 8410 return RetentionPriority.MEDIUM;
8411 } 8411 }
8412 } 8412 }
8413 return RetentionPriority.LOW; 8413 return RetentionPriority.LOW;
8414 } 8414 }
8415 } 8415 }
8416 8416
8417 /** 8417 /**
8418 * An error listener that can be enabled or disabled while executing a function.
8419 */
8420 class DisablableErrorListener implements AnalysisErrorListener {
scheglov 2015/09/08 15:36:22 Why don't we put it in error.dart ?
Brian Wilkerson 2015/09/08 17:10:33 Done
8421 /**
8422 * The listener to which errors will be reported if this listener is enabled.
8423 */
8424 final AnalysisErrorListener baseListener;
8425
8426 /**
8427 * A flag indicating whether this listener is currently enabled.
8428 */
8429 bool enabled = true;
8430
8431 /**
8432 * Initialize a newly created listener to report errors to the given
8433 * [baseListener].
8434 */
8435 DisablableErrorListener(this.baseListener);
8436
8437 /**
8438 * Disable the processing of errors while evaluating the given [function].
8439 * Return the value returned by the function.
8440 */
8441 dynamic disableWhile(dynamic function()) {
8442 bool wasEnabled = enabled;
8443 try {
8444 enabled = false;
8445 return function();
8446 } finally {
8447 enabled = wasEnabled;
8448 }
8449 }
8450
8451 /**
8452 * Disable the processing of errors while evaluating the given [function].
8453 * Return the value returned by the function.
8454 */
8455 dynamic enableWhile(dynamic function()) {
8456 bool wasEnabled = enabled;
8457 try {
8458 enabled = true;
8459 return function();
8460 } finally {
8461 enabled = wasEnabled;
8462 }
8463 }
8464
8465 @override
8466 void onError(AnalysisError error) {
8467 if (enabled) {
8468 baseListener.onError(error);
8469 }
8470 }
8471 }
8472
8473 /**
8418 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings for a single 8474 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings for a single
8419 * Dart source. 8475 * Dart source.
8420 */ 8476 */
8421 class GenerateDartErrorsTask extends AnalysisTask { 8477 class GenerateDartErrorsTask extends AnalysisTask {
8422 /** 8478 /**
8423 * The source for which errors and warnings are to be produced. 8479 * The source for which errors and warnings are to be produced.
8424 */ 8480 */
8425 final Source source; 8481 final Source source;
8426 8482
8427 /** 8483 /**
(...skipping 3606 matching lines...) Expand 10 before | Expand all | Expand 10 after
12034 PendingFuture pendingFuture = 12090 PendingFuture pendingFuture =
12035 new PendingFuture<T>(_context, source, computeValue); 12091 new PendingFuture<T>(_context, source, computeValue);
12036 if (!pendingFuture.evaluate(sourceEntry)) { 12092 if (!pendingFuture.evaluate(sourceEntry)) {
12037 _context._pendingFutureSources 12093 _context._pendingFutureSources
12038 .putIfAbsent(source, () => <PendingFuture>[]) 12094 .putIfAbsent(source, () => <PendingFuture>[])
12039 .add(pendingFuture); 12095 .add(pendingFuture);
12040 } 12096 }
12041 return pendingFuture.future; 12097 return pendingFuture.future;
12042 } 12098 }
12043 } 12099 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | pkg/analyzer/lib/src/generated/resolver.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698