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

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 2343713002: fix #27151, list and map literals infer using up and down info (Closed)
Patch Set: format Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.resolver; 5 library analyzer.src.generated.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 7264 matching lines...) Expand 10 before | Expand all | Expand 10 after
7275 if (contextType is FunctionType) { 7275 if (contextType is FunctionType) {
7276 DartType originalType = node.function.staticType; 7276 DartType originalType = node.function.staticType;
7277 DartType returnContextType = InferenceContext.getContext(node); 7277 DartType returnContextType = InferenceContext.getContext(node);
7278 TypeSystem ts = typeSystem; 7278 TypeSystem ts = typeSystem;
7279 if (returnContextType != null && 7279 if (returnContextType != null &&
7280 node.typeArguments == null && 7280 node.typeArguments == null &&
7281 originalType is FunctionType && 7281 originalType is FunctionType &&
7282 originalType.typeFormals.isNotEmpty && 7282 originalType.typeFormals.isNotEmpty &&
7283 ts is StrongTypeSystemImpl) { 7283 ts is StrongTypeSystemImpl) {
7284 contextType = ts.inferGenericFunctionCall(typeProvider, originalType, 7284 contextType = ts.inferGenericFunctionCall(typeProvider, originalType,
7285 DartType.EMPTY_LIST, DartType.EMPTY_LIST, returnContextType); 7285 DartType.EMPTY_LIST, DartType.EMPTY_LIST, originalType.returnType, r eturnContextType);
7286 } 7286 }
7287 7287
7288 InferenceContext.setType(node.argumentList, contextType); 7288 InferenceContext.setType(node.argumentList, contextType);
7289 } 7289 }
7290 } 7290 }
7291 7291
7292 void _inferFormalParameterList(FormalParameterList node, DartType type) { 7292 void _inferFormalParameterList(FormalParameterList node, DartType type) {
7293 if (typeAnalyzer.inferFormalParameterList(node, type)) { 7293 if (typeAnalyzer.inferFormalParameterList(node, type)) {
7294 // TODO(leafp): This gets dropped on the floor if we're in the field 7294 // TODO(leafp): This gets dropped on the floor if we're in the field
7295 // inference task. We should probably keep these infos. 7295 // inference task. We should probably keep these infos.
(...skipping 3894 matching lines...) Expand 10 before | Expand all | Expand 10 after
11190 return null; 11190 return null;
11191 } 11191 }
11192 if (identical(node.staticElement, variable)) { 11192 if (identical(node.staticElement, variable)) {
11193 if (node.inSetterContext()) { 11193 if (node.inSetterContext()) {
11194 result = true; 11194 result = true;
11195 } 11195 }
11196 } 11196 }
11197 return null; 11197 return null;
11198 } 11198 }
11199 } 11199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698