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

Unified Diff: pkg/analyzer/lib/src/generated/constant.dart

Issue 1620963003: final fields shouldn't be dependencies of const variables (Closed) Base URL: git@github.com:dart-lang/sdk.git@movetest
Patch Set: Created 4 years, 11 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: pkg/analyzer/lib/src/generated/constant.dart
diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart
index b5ccca6d4af3762333a38ae231a5c1ee7d3a2d11..f45d7082ad60d5713ee4f8bd5f109fa52d52042a 100644
--- a/pkg/analyzer/lib/src/generated/constant.dart
+++ b/pkg/analyzer/lib/src/generated/constant.dart
@@ -443,13 +443,6 @@ class ConstantEvaluationEngine {
* Determine which constant elements need to have their values computed
* prior to computing the value of [constant], and report them using
* [callback].
- *
- * Note that it's possible (in erroneous code) for a constant to depend on a
- * non-constant. When this happens, we report the dependency anyhow so that
- * if the non-constant changes to a constant, we will know to recompute the
- * thing that depends on it. [computeDependencies] and
- * [computeConstantValue] are responsible for ignoring the request if they
- * are asked to act on a non-constant target.
*/
void computeDependencies(
ConstantEvaluationTarget constant, ReferenceFinderCallback callback) {
@@ -5250,7 +5243,7 @@ class ReferenceFinder extends RecursiveAstVisitor<Object> {
if (element is PropertyAccessorElement) {
element = (element as PropertyAccessorElement).variable;
}
- if (element is VariableElement) {
+ if (element is VariableElement && element.isConst) {
_callback(element);
}
return null;

Powered by Google App Engine
This is Rietveld 408576698