| Index: pkg/analyzer/test/generated/analysis_context_factory.dart
|
| diff --git a/pkg/analyzer/test/generated/analysis_context_factory.dart b/pkg/analyzer/test/generated/analysis_context_factory.dart
|
| index 78c62e99fe7049fe9d02631a84dc10a76c947dfb..272e26e61f40c267224d62dff0cf72a460db0fa7 100644
|
| --- a/pkg/analyzer/test/generated/analysis_context_factory.dart
|
| +++ b/pkg/analyzer/test/generated/analysis_context_factory.dart
|
| @@ -90,8 +90,7 @@ class AnalysisContextFactory {
|
| ResourceProvider resourceProvider]) {
|
| resourceProvider ??= PhysicalResourceProvider.INSTANCE;
|
| DartSdk sdk = new _AnalysisContextFactory_initContextWithCore(
|
| - resourceProvider, '/fake/sdk',
|
| - enableAsync: context.analysisOptions.enableAsync);
|
| + resourceProvider, '/fake/sdk');
|
| List<UriResolver> resolvers = <UriResolver>[
|
| new DartUriResolver(sdk),
|
| new ResourceUriResolver(resourceProvider)
|
| @@ -184,104 +183,94 @@ class AnalysisContextFactory {
|
| //
|
| // dart:async
|
| //
|
| - Source asyncSource;
|
| - LibraryElementImpl asyncLibrary;
|
| - if (context.analysisOptions.enableAsync) {
|
| - asyncLibrary = new LibraryElementImpl.forNode(
|
| - coreContext, AstFactory.libraryIdentifier2(["dart", "async"]));
|
| - CompilationUnitElementImpl asyncUnit =
|
| - new CompilationUnitElementImpl("async.dart");
|
| - asyncSource = sourceFactory.forUri(DartSdk.DART_ASYNC);
|
| - coreContext.setContents(asyncSource, "");
|
| - asyncUnit.librarySource = asyncUnit.source = asyncSource;
|
| - asyncLibrary.definingCompilationUnit = asyncUnit;
|
| - // Future
|
| - ClassElementImpl futureElement =
|
| - ElementFactory.classElement2("Future", ["T"]);
|
| - futureElement.enclosingElement = asyncUnit;
|
| - // factory Future.value([value])
|
| - ConstructorElementImpl futureConstructor =
|
| - ElementFactory.constructorElement2(futureElement, "value");
|
| - futureConstructor.parameters = <ParameterElement>[
|
| - ElementFactory.positionalParameter2("value", provider.dynamicType)
|
| - ];
|
| - futureConstructor.factory = true;
|
| - futureElement.constructors = <ConstructorElement>[futureConstructor];
|
| - // Future then(onValue(T value), { Function onError });
|
| - TypeDefiningElement futureThenR = DynamicElementImpl.instance;
|
| - if (context.analysisOptions.strongMode) {
|
| - futureThenR = ElementFactory.typeParameterWithType('R');
|
| - }
|
| - FunctionElementImpl thenOnValue = ElementFactory.functionElement3(
|
| - 'onValue',
|
| - DynamicElementImpl.instance,
|
| - [futureElement.typeParameters[0]],
|
| - null);
|
| - thenOnValue.synthetic = true;
|
| -
|
| - DartType futureRType = futureElement.type.instantiate([futureThenR.type]);
|
| - MethodElementImpl thenMethod = ElementFactory
|
| - .methodElementWithParameters(futureElement, "then", futureRType, [
|
| - ElementFactory.requiredParameter2("onValue", thenOnValue.type),
|
| - ElementFactory.namedParameter2("onError", provider.functionType)
|
| - ]);
|
| - if (!futureThenR.type.isDynamic) {
|
| - thenMethod.typeParameters = <TypeParameterElement>[futureThenR];
|
| - }
|
| - thenOnValue.enclosingElement = thenMethod;
|
| - thenOnValue.type = new FunctionTypeImpl(thenOnValue);
|
| - (thenMethod.parameters[0] as ParameterElementImpl).type =
|
| - thenOnValue.type;
|
| - thenMethod.type = new FunctionTypeImpl(thenMethod);
|
| -
|
| - futureElement.methods = <MethodElement>[thenMethod];
|
| - // Completer
|
| - ClassElementImpl completerElement =
|
| - ElementFactory.classElement2("Completer", ["T"]);
|
| - ConstructorElementImpl completerConstructor =
|
| - ElementFactory.constructorElement2(completerElement, null);
|
| - completerElement.constructors = <ConstructorElement>[
|
| - completerConstructor
|
| - ];
|
| - // StreamSubscription
|
| - ClassElementImpl streamSubscriptionElement =
|
| - ElementFactory.classElement2("StreamSubscription", ["T"]);
|
| - // Stream
|
| - ClassElementImpl streamElement =
|
| - ElementFactory.classElement2("Stream", ["T"]);
|
| - streamElement.constructors = <ConstructorElement>[
|
| - ElementFactory.constructorElement2(streamElement, null)
|
| - ];
|
| - DartType returnType = streamSubscriptionElement.type
|
| - .instantiate(streamElement.type.typeArguments);
|
| - FunctionElementImpl listenOnData = ElementFactory.functionElement3(
|
| - 'onData',
|
| - VoidTypeImpl.instance.element,
|
| - <TypeDefiningElement>[streamElement.typeParameters[0]],
|
| - null);
|
| - listenOnData.synthetic = true;
|
| - List<DartType> parameterTypes = <DartType>[
|
| - listenOnData.type,
|
| - ];
|
| - // TODO(brianwilkerson) This is missing the optional parameters.
|
| - MethodElementImpl listenMethod =
|
| - ElementFactory.methodElement('listen', returnType, parameterTypes);
|
| - streamElement.methods = <MethodElement>[listenMethod];
|
| - listenMethod.type = new FunctionTypeImpl(listenMethod);
|
| -
|
| - FunctionElementImpl listenParamFunction = parameterTypes[0].element;
|
| - listenParamFunction.enclosingElement = listenMethod;
|
| - listenParamFunction.type = new FunctionTypeImpl(listenParamFunction);
|
| - ParameterElementImpl listenParam = listenMethod.parameters[0];
|
| - listenParam.type = listenParamFunction.type;
|
| -
|
| - asyncUnit.types = <ClassElement>[
|
| - completerElement,
|
| - futureElement,
|
| - streamElement,
|
| - streamSubscriptionElement
|
| - ];
|
| + LibraryElementImpl asyncLibrary = new LibraryElementImpl.forNode(
|
| + coreContext, AstFactory.libraryIdentifier2(["dart", "async"]));
|
| + CompilationUnitElementImpl asyncUnit =
|
| + new CompilationUnitElementImpl("async.dart");
|
| + Source asyncSource = sourceFactory.forUri(DartSdk.DART_ASYNC);
|
| + coreContext.setContents(asyncSource, "");
|
| + asyncUnit.librarySource = asyncUnit.source = asyncSource;
|
| + asyncLibrary.definingCompilationUnit = asyncUnit;
|
| + // Future
|
| + ClassElementImpl futureElement =
|
| + ElementFactory.classElement2("Future", ["T"]);
|
| + futureElement.enclosingElement = asyncUnit;
|
| + // factory Future.value([value])
|
| + ConstructorElementImpl futureConstructor =
|
| + ElementFactory.constructorElement2(futureElement, "value");
|
| + futureConstructor.parameters = <ParameterElement>[
|
| + ElementFactory.positionalParameter2("value", provider.dynamicType)
|
| + ];
|
| + futureConstructor.factory = true;
|
| + futureElement.constructors = <ConstructorElement>[futureConstructor];
|
| + // Future then(onValue(T value), { Function onError });
|
| + TypeDefiningElement futureThenR = DynamicElementImpl.instance;
|
| + if (context.analysisOptions.strongMode) {
|
| + futureThenR = ElementFactory.typeParameterWithType('R');
|
| + }
|
| + FunctionElementImpl thenOnValue = ElementFactory.functionElement3('onValue',
|
| + DynamicElementImpl.instance, [futureElement.typeParameters[0]], null);
|
| + thenOnValue.synthetic = true;
|
| +
|
| + DartType futureRType = futureElement.type.instantiate([futureThenR.type]);
|
| + MethodElementImpl thenMethod = ElementFactory
|
| + .methodElementWithParameters(futureElement, "then", futureRType, [
|
| + ElementFactory.requiredParameter2("onValue", thenOnValue.type),
|
| + ElementFactory.namedParameter2("onError", provider.functionType)
|
| + ]);
|
| + if (!futureThenR.type.isDynamic) {
|
| + thenMethod.typeParameters = <TypeParameterElement>[futureThenR];
|
| }
|
| + thenOnValue.enclosingElement = thenMethod;
|
| + thenOnValue.type = new FunctionTypeImpl(thenOnValue);
|
| + (thenMethod.parameters[0] as ParameterElementImpl).type = thenOnValue.type;
|
| + thenMethod.type = new FunctionTypeImpl(thenMethod);
|
| +
|
| + futureElement.methods = <MethodElement>[thenMethod];
|
| + // Completer
|
| + ClassElementImpl completerElement =
|
| + ElementFactory.classElement2("Completer", ["T"]);
|
| + ConstructorElementImpl completerConstructor =
|
| + ElementFactory.constructorElement2(completerElement, null);
|
| + completerElement.constructors = <ConstructorElement>[completerConstructor];
|
| + // StreamSubscription
|
| + ClassElementImpl streamSubscriptionElement =
|
| + ElementFactory.classElement2("StreamSubscription", ["T"]);
|
| + // Stream
|
| + ClassElementImpl streamElement =
|
| + ElementFactory.classElement2("Stream", ["T"]);
|
| + streamElement.constructors = <ConstructorElement>[
|
| + ElementFactory.constructorElement2(streamElement, null)
|
| + ];
|
| + DartType returnType = streamSubscriptionElement.type
|
| + .instantiate(streamElement.type.typeArguments);
|
| + FunctionElementImpl listenOnData = ElementFactory.functionElement3(
|
| + 'onData',
|
| + VoidTypeImpl.instance.element,
|
| + <TypeDefiningElement>[streamElement.typeParameters[0]],
|
| + null);
|
| + listenOnData.synthetic = true;
|
| + List<DartType> parameterTypes = <DartType>[
|
| + listenOnData.type,
|
| + ];
|
| + // TODO(brianwilkerson) This is missing the optional parameters.
|
| + MethodElementImpl listenMethod =
|
| + ElementFactory.methodElement('listen', returnType, parameterTypes);
|
| + streamElement.methods = <MethodElement>[listenMethod];
|
| + listenMethod.type = new FunctionTypeImpl(listenMethod);
|
| +
|
| + FunctionElementImpl listenParamFunction = parameterTypes[0].element;
|
| + listenParamFunction.enclosingElement = listenMethod;
|
| + listenParamFunction.type = new FunctionTypeImpl(listenParamFunction);
|
| + ParameterElementImpl listenParam = listenMethod.parameters[0];
|
| + listenParam.type = listenParamFunction.type;
|
| +
|
| + asyncUnit.types = <ClassElement>[
|
| + completerElement,
|
| + futureElement,
|
| + streamElement,
|
| + streamSubscriptionElement
|
| + ];
|
| //
|
| // dart:html
|
| //
|
| @@ -564,18 +553,14 @@ class TestPackageUriResolver extends UriResolver {
|
| }
|
|
|
| class _AnalysisContextFactory_initContextWithCore extends FolderBasedDartSdk {
|
| - final bool enableAsync;
|
| _AnalysisContextFactory_initContextWithCore(
|
| - ResourceProvider resourceProvider, String sdkPath,
|
| - {this.enableAsync: true})
|
| + ResourceProvider resourceProvider, String sdkPath)
|
| : super(resourceProvider, resourceProvider.getFolder(sdkPath));
|
|
|
| @override
|
| LibraryMap initialLibraryMap(bool useDart2jsPaths) {
|
| LibraryMap map = new LibraryMap();
|
| - if (enableAsync) {
|
| - _addLibrary(map, DartSdk.DART_ASYNC, false, "async.dart");
|
| - }
|
| + _addLibrary(map, DartSdk.DART_ASYNC, false, "async.dart");
|
| _addLibrary(map, DartSdk.DART_CORE, false, "core.dart");
|
| _addLibrary(map, DartSdk.DART_HTML, false, "html_dartium.dart");
|
| _addLibrary(map, AnalysisContextFactory._DART_MATH, false, "math.dart");
|
|
|