Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/engine.dart |
| diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart |
| index 5eccbf7ee5b33c7932856815551ae5e221f02f47..80b2ad660c9136d9ce24d89d8fa77589af93eeff 100644 |
| --- a/pkg/analyzer/lib/src/generated/engine.dart |
| +++ b/pkg/analyzer/lib/src/generated/engine.dart |
| @@ -8415,6 +8415,62 @@ class DefaultRetentionPolicy implements CacheRetentionPolicy { |
| } |
| /** |
| + * An error listener that can be enabled or disabled while executing a function. |
| + */ |
| +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
|
| + /** |
| + * The listener to which errors will be reported if this listener is enabled. |
| + */ |
| + final AnalysisErrorListener baseListener; |
| + |
| + /** |
| + * A flag indicating whether this listener is currently enabled. |
| + */ |
| + bool enabled = true; |
| + |
| + /** |
| + * Initialize a newly created listener to report errors to the given |
| + * [baseListener]. |
| + */ |
| + DisablableErrorListener(this.baseListener); |
| + |
| + /** |
| + * Disable the processing of errors while evaluating the given [function]. |
| + * Return the value returned by the function. |
| + */ |
| + dynamic disableWhile(dynamic function()) { |
| + bool wasEnabled = enabled; |
| + try { |
| + enabled = false; |
| + return function(); |
| + } finally { |
| + enabled = wasEnabled; |
| + } |
| + } |
| + |
| + /** |
| + * Disable the processing of errors while evaluating the given [function]. |
| + * Return the value returned by the function. |
| + */ |
| + dynamic enableWhile(dynamic function()) { |
| + bool wasEnabled = enabled; |
| + try { |
| + enabled = true; |
| + return function(); |
| + } finally { |
| + enabled = wasEnabled; |
| + } |
| + } |
| + |
| + @override |
| + void onError(AnalysisError error) { |
| + if (enabled) { |
| + baseListener.onError(error); |
| + } |
| + } |
| +} |
| + |
| +/** |
| * Instances of the class `GenerateDartErrorsTask` generate errors and warnings for a single |
| * Dart source. |
| */ |