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

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

Issue 1625273003: Don't add sources to DartSdk contexts. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk_io.dart ('k') | pkg/analyzer/test/src/mock_sdk.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 }); 221 });
222 }); 222 });
223 } 223 }
224 224
225 @override 225 @override
226 AnalysisContextImpl get context { 226 AnalysisContextImpl get context {
227 if (_analysisContext == null) { 227 if (_analysisContext == null) {
228 _analysisContext = new _SdkAnalysisContext(this); 228 _analysisContext = new _SdkAnalysisContext(this);
229 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); 229 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]);
230 _analysisContext.sourceFactory = factory; 230 _analysisContext.sourceFactory = factory;
231 ChangeSet changeSet = new ChangeSet();
232 for (String uri in uris) {
233 Source source = factory.forUri(uri);
234 changeSet.addedSource(source);
235 }
236 _analysisContext.applyChanges(changeSet);
237 } 231 }
238 return _analysisContext; 232 return _analysisContext;
239 } 233 }
240 234
241 @override 235 @override
242 List<SdkLibrary> get sdkLibraries => LIBRARIES; 236 List<SdkLibrary> get sdkLibraries => LIBRARIES;
243 237
244 @override 238 @override
245 String get sdkVersion => throw unimplemented; 239 String get sdkVersion => throw unimplemented;
246 240
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 365
372 @override 366 @override
373 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { 367 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) {
374 if (factory == null) { 368 if (factory == null) {
375 return super.createCacheFromSourceFactory(factory); 369 return super.createCacheFromSourceFactory(factory);
376 } 370 }
377 return new AnalysisCache( 371 return new AnalysisCache(
378 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 372 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
379 } 373 }
380 } 374 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk_io.dart ('k') | pkg/analyzer/test/src/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698