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

Side by Side Diff: pkg/analysis_server/test/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
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 testing.mock_sdk; 5 library testing.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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 provider.newFile(library.path, library.content); 215 provider.newFile(library.path, library.content);
216 }); 216 });
217 } 217 }
218 218
219 @override 219 @override
220 AnalysisContext get context { 220 AnalysisContext get context {
221 if (_analysisContext == null) { 221 if (_analysisContext == null) {
222 _analysisContext = new SdkAnalysisContext(); 222 _analysisContext = new SdkAnalysisContext();
223 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); 223 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]);
224 _analysisContext.sourceFactory = factory; 224 _analysisContext.sourceFactory = factory;
225 ChangeSet changeSet = new ChangeSet();
226 for (String uri in uris) {
227 Source source = factory.forUri(uri);
228 changeSet.addedSource(source);
229 }
230 _analysisContext.applyChanges(changeSet);
231 } 225 }
232 return _analysisContext; 226 return _analysisContext;
233 } 227 }
234 228
235 @override 229 @override
236 List<SdkLibrary> get sdkLibraries => LIBRARIES; 230 List<SdkLibrary> get sdkLibraries => LIBRARIES;
237 231
238 @override 232 @override
239 String get sdkVersion => throw unimplemented; 233 String get sdkVersion => throw unimplemented;
240 234
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 bool get isInternal => shortName.startsWith('dart:_'); 332 bool get isInternal => shortName.startsWith('dart:_');
339 333
340 @override 334 @override
341 bool get isShared => throw unimplemented; 335 bool get isShared => throw unimplemented;
342 336
343 @override 337 @override
344 bool get isVmLibrary => throw unimplemented; 338 bool get isVmLibrary => throw unimplemented;
345 339
346 UnimplementedError get unimplemented => new UnimplementedError(); 340 UnimplementedError get unimplemented => new UnimplementedError();
347 } 341 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/domain_diagnostic_test.dart ('k') | pkg/analyzer/lib/src/generated/sdk_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698