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

Unified Diff: pkg/analyzer/lib/src/task/strong/checker.dart

Issue 1462133005: Downwards inference. This adds support to the resolver for downwards (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments 2 Created 5 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/task/strong/checker.dart
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 5a6bcaa262e94275f2ccbac1c23eb0771392b4f0..9f40127818c0179058f7894412189251e37811ff 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -467,6 +467,10 @@ class CodeChecker extends RecursiveAstVisitor {
if (node.typeArguments != null) {
var targs = node.typeArguments.arguments;
if (targs.length > 0) type = targs[0].type;
+ } else if (node.staticType != null && node.staticType is InterfaceType) {
Brian Wilkerson 2015/12/01 22:31:09 You can remove "node.staticType != null && " (it's
Leaf 2015/12/01 23:39:24 Done.
+ InterfaceType listT = node.staticType;
+ var targs = listT.typeArguments;
+ if (targs != null && targs.length > 0) type = targs[0];
}
var elements = node.elements;
for (int i = 0; i < elements.length; i++) {
@@ -483,6 +487,13 @@ class CodeChecker extends RecursiveAstVisitor {
var targs = node.typeArguments.arguments;
if (targs.length > 0) ktype = targs[0].type;
if (targs.length > 1) vtype = targs[1].type;
+ } else if (node.staticType != null && node.staticType is InterfaceType) {
Brian Wilkerson 2015/12/01 22:31:09 ditto
Leaf 2015/12/01 23:39:24 Done.
+ InterfaceType mapT = node.staticType;
+ var targs = mapT.typeArguments;
+ if (targs != null) {
+ if (targs.length > 0) ktype = targs[0];
+ if (targs.length > 1) vtype = targs[1];
+ }
}
var entries = node.entries;
for (int i = 0; i < entries.length; i++) {
@@ -947,7 +958,6 @@ class CodeChecker extends RecursiveAstVisitor {
void _recordMessage(StaticInfo info) {
if (info == null) return;
var error = info.toAnalysisError();
-
var severity = error.errorCode.errorSeverity;
if (severity == ErrorSeverity.ERROR) _failure = true;
if (severity != ErrorSeverity.INFO || _hints) {

Powered by Google App Engine
This is Rietveld 408576698