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

Unified Diff: lib/src/codegen/side_effect_analysis.dart

Issue 1840203002: More analyzer updates, and handle negative_tests (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/codegen/side_effect_analysis.dart
diff --git a/lib/src/codegen/side_effect_analysis.dart b/lib/src/codegen/side_effect_analysis.dart
index 3a51a46f0e730cd40c764dd10a183a7926054f67..da5de6bf00f5b91042c56c08585d5932e8a44584 100644
--- a/lib/src/codegen/side_effect_analysis.dart
+++ b/lib/src/codegen/side_effect_analysis.dart
@@ -10,6 +10,7 @@ import 'package:analyzer/src/generated/error.dart'
show AnalysisErrorListener, ErrorReporter;
import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
import 'package:analyzer/src/generated/source.dart' show Source;
+import 'package:analyzer/src/dart/ast/ast.dart';
/// True is the expression can be evaluated multiple times without causing
/// code execution. This is true for final fields. This can be true for local
@@ -54,6 +55,12 @@ bool isStateless(FunctionBody function, Expression node, [AstNode context]) {
/// This accounts for closures that may have been created outside of [context].
bool _isPotentiallyMutated(FunctionBody function, VariableElement e,
[AstNode context]) {
+ if (function is FunctionBodyImpl && function.localVariableInfo == null) {
+ // TODO(jmesserly): this is a caching bug in Analyzer. They don't restore
+ // this info in some cases.
+ return true;
+ }
+
if (function.isPotentiallyMutatedInClosure(e)) return true;
if (function.isPotentiallyMutatedInScope(e)) {
// Need to visit the context looking for assignment to this local.

Powered by Google App Engine
This is Rietveld 408576698