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

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

Issue 1757343002: upgrade to latest analyzer (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1272732e9828b517494053ed05f24dde018a0583..9b58c653d2324dce72a1f1f2eafcecbcdd1ebd2e 100644
--- a/lib/src/codegen/side_effect_analysis.dart
+++ b/lib/src/codegen/side_effect_analysis.dart
@@ -30,10 +30,10 @@ import 'package:analyzer/src/generated/source.dart' show Source;
/// certain the [node] is stateless, because generated code may rely on the
/// correctness of a `true` value. However it may return `false` for things
/// that are in fact, stateless.
-bool isStateless(Expression node, [AstNode context]) {
+bool isStateless(FunctionBody function, Expression node, [AstNode context]) {
// `this` and `super` cannot be reassigned.
if (node is ThisExpression || node is SuperExpression) return true;
- if (node is SimpleIdentifier) {
+ if (node is Identifier) {
var e = node.staticElement;
if (e is PropertyAccessorElement) {
e = e.variable;
@@ -42,7 +42,7 @@ bool isStateless(Expression node, [AstNode context]) {
if (e.isFinal) return true;
if (e is LocalVariableElement || e is ParameterElement) {
// make sure the local isn't mutated in the context.
- return !_isPotentiallyMutated(e, context);
+ return !_isPotentiallyMutated(function, e, context);
}
}
}
@@ -51,9 +51,9 @@ bool isStateless(Expression node, [AstNode context]) {
/// Returns true if the local variable is potentially mutated within [context].
/// This accounts for closures that may have been created outside of [context].
-bool _isPotentiallyMutated(VariableElement e, [AstNode context]) {
- if (e.isPotentiallyMutatedInClosure) return true;
- if (e.isPotentiallyMutatedInScope) {
+bool _isPotentiallyMutated(FunctionBody function, VariableElement e, [AstNode context]) {
+ if (function.isPotentiallyMutatedInClosure(e)) return true;
+ if (function.isPotentiallyMutatedInScope(e)) {
// Need to visit the context looking for assignment to this local.
if (context != null) {
var visitor = new _AssignmentFinder(e);
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698