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

Side by Side Diff: pkg/analyzer/test/src/mock_sdk.dart

Issue 1591653003: plumb through enableAsync (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 4 years, 11 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.test.src.mock_sdk; 5 library analyzer.test.src.mock_sdk;
6 6
7 import 'package:analyzer/file_system/file_system.dart' as resource; 7 import 'package:analyzer/file_system/file_system.dart' as resource;
8 import 'package:analyzer/file_system/memory_file_system.dart' as resource; 8 import 'package:analyzer/file_system/memory_file_system.dart' as resource;
9 import 'package:analyzer/src/context/context.dart'; 9 import 'package:analyzer/src/context/context.dart';
10 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 static const List<SdkLibrary> LIBRARIES = const [ 178 static const List<SdkLibrary> LIBRARIES = const [
179 LIB_CORE, 179 LIB_CORE,
180 LIB_ASYNC, 180 LIB_ASYNC,
181 LIB_COLLECTION, 181 LIB_COLLECTION,
182 LIB_CONVERT, 182 LIB_CONVERT,
183 LIB_MATH, 183 LIB_MATH,
184 LIB_HTML, 184 LIB_HTML,
185 ]; 185 ];
186 186
187 static const List<SdkLibrary> LIBRARIES_NO_ASYNC = const [
188 LIB_CORE,
189 ];
190
187 final resource.MemoryResourceProvider provider = 191 final resource.MemoryResourceProvider provider =
188 new resource.MemoryResourceProvider(); 192 new resource.MemoryResourceProvider();
189 193
190 /** 194 /**
191 * The [AnalysisContext] which is used for all of the sources. 195 * The [AnalysisContext] which is used for all of the sources.
192 */ 196 */
193 InternalAnalysisContext _analysisContext; 197 InternalAnalysisContext _analysisContext;
194 198
195 MockSdk() { 199 MockSdk({bool dartAsync: true}) {
196 LIBRARIES.forEach((_MockSdkLibrary library) { 200 List<SdkLibrary> libraries = dartAsync ? LIBRARIES : LIBRARIES_NO_ASYNC;
201 libraries.forEach((_MockSdkLibrary library) {
197 provider.newFile(library.path, library.content); 202 provider.newFile(library.path, library.content);
198 }); 203 });
199 } 204 }
200 205
201 @override 206 @override
202 AnalysisContext get context { 207 AnalysisContext get context {
203 if (_analysisContext == null) { 208 if (_analysisContext == null) {
204 _analysisContext = new SdkAnalysisContext(); 209 _analysisContext = new SdkAnalysisContext();
205 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); 210 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]);
206 _analysisContext.sourceFactory = factory; 211 _analysisContext.sourceFactory = factory;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 bool get isInternal => throw unimplemented; 324 bool get isInternal => throw unimplemented;
320 325
321 @override 326 @override
322 bool get isShared => throw unimplemented; 327 bool get isShared => throw unimplemented;
323 328
324 @override 329 @override
325 bool get isVmLibrary => throw unimplemented; 330 bool get isVmLibrary => throw unimplemented;
326 331
327 UnimplementedError get unimplemented => new UnimplementedError(); 332 UnimplementedError get unimplemented => new UnimplementedError();
328 } 333 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698