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

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

Issue 1117373002: fixes #147, add more cases to isStateless (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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/runtime/dart/convert.js ('k') | no next file » | 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 4cccd421fccccdeddabf066261ee7d729f32a1cf..cdf8e7939a358a1f9b5c7bb2d7f11865e79376a5 100644
--- a/lib/src/codegen/side_effect_analysis.dart
+++ b/lib/src/codegen/side_effect_analysis.dart
@@ -28,6 +28,8 @@ import 'package:analyzer/src/generated/element.dart';
/// correctness of a `true` value. However it may return `false` for things
/// that are in fact, stateless.
bool isStateless(Expression node, [AstNode context]) {
+ // `this` and `super` cannot be reassigned.
+ if (node is ThisExpression || node is SuperExpression) return true;
if (node is SimpleIdentifier) {
var e = node.staticElement;
if (e is PropertyAccessorElement) e = e.variable;
« no previous file with comments | « lib/runtime/dart/convert.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698