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

Side by Side Diff: pkg/analyzer/test/generated/analysis_context_factory.dart

Issue 2253923002: fix #27088, future then upwards inference (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.test.generated.analysis_context_factory; 5 library analyzer.test.generated.analysis_context_factory;
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 ElementFactory.positionalParameter2("value", provider.dynamicType) 205 ElementFactory.positionalParameter2("value", provider.dynamicType)
206 ]; 206 ];
207 futureConstructor.factory = true; 207 futureConstructor.factory = true;
208 futureElement.constructors = <ConstructorElement>[futureConstructor]; 208 futureElement.constructors = <ConstructorElement>[futureConstructor];
209 // Future then(onValue(T value), { Function onError }); 209 // Future then(onValue(T value), { Function onError });
210 TypeDefiningElement futureThenR = DynamicElementImpl.instance; 210 TypeDefiningElement futureThenR = DynamicElementImpl.instance;
211 if (context.analysisOptions.strongMode) { 211 if (context.analysisOptions.strongMode) {
212 futureThenR = ElementFactory.typeParameterWithType('R'); 212 futureThenR = ElementFactory.typeParameterWithType('R');
213 } 213 }
214 FunctionElementImpl thenOnValue = ElementFactory.functionElement3( 214 FunctionElementImpl thenOnValue = ElementFactory.functionElement3(
215 'onValue', futureThenR, [futureElement.typeParameters[0]], null); 215 'onValue',
216 DynamicElementImpl.instance,
217 [futureElement.typeParameters[0]],
218 null);
216 thenOnValue.synthetic = true; 219 thenOnValue.synthetic = true;
217 220
218 DartType futureRType = futureElement.type.instantiate([futureThenR.type]); 221 DartType futureRType = futureElement.type.instantiate([futureThenR.type]);
219 MethodElementImpl thenMethod = ElementFactory 222 MethodElementImpl thenMethod = ElementFactory
220 .methodElementWithParameters(futureElement, "then", futureRType, [ 223 .methodElementWithParameters(futureElement, "then", futureRType, [
221 ElementFactory.requiredParameter2("onValue", thenOnValue.type), 224 ElementFactory.requiredParameter2("onValue", thenOnValue.type),
222 ElementFactory.namedParameter2("onError", provider.functionType) 225 ElementFactory.namedParameter2("onError", provider.functionType)
223 ]); 226 ]);
224 if (!futureThenR.type.isDynamic) { 227 if (!futureThenR.type.isDynamic) {
225 thenMethod.typeParameters = [futureThenR]; 228 thenMethod.typeParameters = [futureThenR];
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 583
581 void _addLibrary(LibraryMap map, String uri, bool isInternal, String path) { 584 void _addLibrary(LibraryMap map, String uri, bool isInternal, String path) {
582 SdkLibraryImpl library = new SdkLibraryImpl(uri); 585 SdkLibraryImpl library = new SdkLibraryImpl(uri);
583 if (isInternal) { 586 if (isInternal) {
584 library.category = "Internal"; 587 library.category = "Internal";
585 } 588 }
586 library.path = path; 589 library.path = path;
587 map.setLibrary(uri, library); 590 map.setLibrary(uri, library);
588 } 591 }
589 } 592 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | pkg/analyzer/test/src/task/strong/checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698