| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 null); | 219 null); |
| 220 thenOnValue.synthetic = true; | 220 thenOnValue.synthetic = true; |
| 221 | 221 |
| 222 DartType futureRType = futureElement.type.instantiate([futureThenR.type]); | 222 DartType futureRType = futureElement.type.instantiate([futureThenR.type]); |
| 223 MethodElementImpl thenMethod = ElementFactory | 223 MethodElementImpl thenMethod = ElementFactory |
| 224 .methodElementWithParameters(futureElement, "then", futureRType, [ | 224 .methodElementWithParameters(futureElement, "then", futureRType, [ |
| 225 ElementFactory.requiredParameter2("onValue", thenOnValue.type), | 225 ElementFactory.requiredParameter2("onValue", thenOnValue.type), |
| 226 ElementFactory.namedParameter2("onError", provider.functionType) | 226 ElementFactory.namedParameter2("onError", provider.functionType) |
| 227 ]); | 227 ]); |
| 228 if (!futureThenR.type.isDynamic) { | 228 if (!futureThenR.type.isDynamic) { |
| 229 thenMethod.typeParameters = [futureThenR]; | 229 thenMethod.typeParameters = <TypeParameterElement>[futureThenR]; |
| 230 } | 230 } |
| 231 thenOnValue.enclosingElement = thenMethod; | 231 thenOnValue.enclosingElement = thenMethod; |
| 232 thenOnValue.type = new FunctionTypeImpl(thenOnValue); | 232 thenOnValue.type = new FunctionTypeImpl(thenOnValue); |
| 233 (thenMethod.parameters[0] as ParameterElementImpl).type = | 233 (thenMethod.parameters[0] as ParameterElementImpl).type = |
| 234 thenOnValue.type; | 234 thenOnValue.type; |
| 235 thenMethod.type = new FunctionTypeImpl(thenMethod); | 235 thenMethod.type = new FunctionTypeImpl(thenMethod); |
| 236 | 236 |
| 237 futureElement.methods = <MethodElement>[thenMethod]; | 237 futureElement.methods = <MethodElement>[thenMethod]; |
| 238 // Completer | 238 // Completer |
| 239 ClassElementImpl completerElement = | 239 ClassElementImpl completerElement = |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 588 |
| 589 void _addLibrary(LibraryMap map, String uri, bool isInternal, String path) { | 589 void _addLibrary(LibraryMap map, String uri, bool isInternal, String path) { |
| 590 SdkLibraryImpl library = new SdkLibraryImpl(uri); | 590 SdkLibraryImpl library = new SdkLibraryImpl(uri); |
| 591 if (isInternal) { | 591 if (isInternal) { |
| 592 library.category = "Internal"; | 592 library.category = "Internal"; |
| 593 } | 593 } |
| 594 library.path = path; | 594 library.path = path; |
| 595 map.setLibrary(uri, library); | 595 map.setLibrary(uri, library); |
| 596 } | 596 } |
| 597 } | 597 } |
| OLD | NEW |