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

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

Issue 2226613004: Suppress follow-on errors when a file is imported with either a prefix or a show clause (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cache URI existence in a modifier' 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) 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.context.mock_sdk; 5 library analyzer.test.src.context.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/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/context/context.dart'; 10 import 'package:analyzer/src/context/context.dart';
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 "dart:collection": "/lib/collection/collection.dart", 291 "dart:collection": "/lib/collection/collection.dart",
292 "dart:convert": "/lib/convert/convert.dart", 292 "dart:convert": "/lib/convert/convert.dart",
293 "dart:_foreign_helper": "/lib/_foreign_helper/_foreign_helper.dart", 293 "dart:_foreign_helper": "/lib/_foreign_helper/_foreign_helper.dart",
294 "dart:math": "/lib/math/math.dart" 294 "dart:math": "/lib/math/math.dart"
295 }; 295 };
296 296
297 static const Map<String, String> NO_ASYNC_URI_MAP = const { 297 static const Map<String, String> NO_ASYNC_URI_MAP = const {
298 "dart:core": "/lib/core/core.dart", 298 "dart:core": "/lib/core/core.dart",
299 }; 299 };
300 300
301 final resource.MemoryResourceProvider provider = 301 final resource.MemoryResourceProvider provider;
302 new resource.MemoryResourceProvider();
303 302
304 final Map<String, String> uriMap; 303 final Map<String, String> uriMap;
305 304
306 /** 305 /**
307 * The [AnalysisContextImpl] which is used for all of the sources. 306 * The [AnalysisContextImpl] which is used for all of the sources.
308 */ 307 */
309 AnalysisContextImpl _analysisContext; 308 AnalysisContextImpl _analysisContext;
310 309
311 @override 310 @override
312 final List<SdkLibrary> sdkLibraries; 311 final List<SdkLibrary> sdkLibraries;
313 312
314 MockSdk({bool dartAsync: true}) 313 MockSdk({bool dartAsync: true, resource.ResourceProvider resourceProvider})
315 : sdkLibraries = dartAsync ? _LIBRARIES : [_LIB_CORE], 314 : provider = resourceProvider ?? new resource.MemoryResourceProvider(),
315 sdkLibraries = dartAsync ? _LIBRARIES : [_LIB_CORE],
316 uriMap = dartAsync ? FULL_URI_MAP : NO_ASYNC_URI_MAP { 316 uriMap = dartAsync ? FULL_URI_MAP : NO_ASYNC_URI_MAP {
317 for (_MockSdkLibrary library in sdkLibraries) { 317 for (_MockSdkLibrary library in sdkLibraries) {
318 provider.newFile(library.path, library.content); 318 provider.newFile(library.path, library.content);
319 library.parts.forEach((String path, String content) { 319 library.parts.forEach((String path, String content) {
320 provider.newFile(path, content); 320 provider.newFile(path, content);
321 }); 321 });
322 } 322 }
323 } 323 }
324 324
325 @override 325 @override
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 @override 437 @override
438 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { 438 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) {
439 if (factory == null) { 439 if (factory == null) {
440 return super.createCacheFromSourceFactory(factory); 440 return super.createCacheFromSourceFactory(factory);
441 } 441 }
442 return new AnalysisCache( 442 return new AnalysisCache(
443 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 443 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
444 } 444 }
445 } 445 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698