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

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

Issue 2551023005: Prepare for decoupling analyzer ASTs from element model. (Closed)
Patch Set: Address review comments Created 4 years 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/static_type_analyzer.dart
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index 53745d27032eba5de4cbc32b64e3217afe28eba6..3367b1639ebca21b2bcdf826d79b6309b31b5b79 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -7,6 +7,7 @@ library analyzer.src.generated.static_type_analyzer;
import 'dart:collection';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -2120,8 +2121,8 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
VariableDeclaration node, Expression initializer) {
if (initializer != null &&
(node.parent as VariableDeclarationList).type == null &&
- (initializer.staticType != null) &&
- (!initializer.staticType.isBottom)) {
+ (resolutionMap.staticTypeForExpression(initializer) != null) &&
+ (!resolutionMap.staticTypeForExpression(initializer).isBottom)) {
VariableElement element = node.element;
if (element is LocalVariableElementImpl) {
element.type = initializer.staticType;

Powered by Google App Engine
This is Rietveld 408576698