OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |