| OLD | NEW |
| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 final resource.MemoryResourceProvider provider = | 205 final resource.MemoryResourceProvider provider = |
| 206 new resource.MemoryResourceProvider(); | 206 new resource.MemoryResourceProvider(); |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * The [AnalysisContext] which is used for all of the sources. | 209 * The [AnalysisContext] which is used for all of the sources. |
| 210 */ | 210 */ |
| 211 InternalAnalysisContext _analysisContext; | 211 InternalAnalysisContext _analysisContext; |
| 212 | 212 |
| 213 MockSdk() { | 213 MockSdk() { |
| 214 LIBRARIES.forEach((_MockSdkLibrary library) { | 214 LIBRARIES.forEach((SdkLibrary library) { |
| 215 provider.newFile(library.path, library.content); | 215 provider.newFile(library.path, (library as _MockSdkLibrary).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(null); | 222 _analysisContext = new SdkAnalysisContext(null); |
| 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 } | 225 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 bool get isInternal => shortName.startsWith('dart:_'); | 332 bool get isInternal => shortName.startsWith('dart:_'); |
| 333 | 333 |
| 334 @override | 334 @override |
| 335 bool get isShared => throw unimplemented; | 335 bool get isShared => throw unimplemented; |
| 336 | 336 |
| 337 @override | 337 @override |
| 338 bool get isVmLibrary => throw unimplemented; | 338 bool get isVmLibrary => throw unimplemented; |
| 339 | 339 |
| 340 UnimplementedError get unimplemented => new UnimplementedError(); | 340 UnimplementedError get unimplemented => new UnimplementedError(); |
| 341 } | 341 } |
| OLD | NEW |