| 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 test.src.mock_sdk; | 5 library 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' as newContext; | 9 import 'package:analyzer/src/context/context.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| 11 import 'package:analyzer/src/generated/sdk.dart'; | 11 import 'package:analyzer/src/generated/sdk.dart'; |
| 12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 13 | 13 |
| 14 class MockSdk implements DartSdk { | 14 class MockSdk implements DartSdk { |
| 15 static const _MockSdkLibrary LIB_CORE = const _MockSdkLibrary( | 15 static const _MockSdkLibrary LIB_CORE = const _MockSdkLibrary( |
| 16 'dart:core', | 16 'dart:core', |
| 17 '/lib/core/core.dart', | 17 '/lib/core/core.dart', |
| 18 ''' | 18 ''' |
| 19 library dart.core; | 19 library dart.core; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 MockSdk() { | 195 MockSdk() { |
| 196 LIBRARIES.forEach((_MockSdkLibrary library) { | 196 LIBRARIES.forEach((_MockSdkLibrary library) { |
| 197 provider.newFile(library.path, library.content); | 197 provider.newFile(library.path, library.content); |
| 198 }); | 198 }); |
| 199 } | 199 } |
| 200 | 200 |
| 201 @override | 201 @override |
| 202 AnalysisContext get context { | 202 AnalysisContext get context { |
| 203 if (_analysisContext == null) { | 203 if (_analysisContext == null) { |
| 204 if (AnalysisEngine.instance.useTaskModel) { | 204 _analysisContext = new SdkAnalysisContext(); |
| 205 _analysisContext = new newContext.SdkAnalysisContext(); | |
| 206 } else { | |
| 207 _analysisContext = new SdkAnalysisContext(); | |
| 208 } | |
| 209 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); | 205 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); |
| 210 _analysisContext.sourceFactory = factory; | 206 _analysisContext.sourceFactory = factory; |
| 211 ChangeSet changeSet = new ChangeSet(); | 207 ChangeSet changeSet = new ChangeSet(); |
| 212 for (String uri in uris) { | 208 for (String uri in uris) { |
| 213 Source source = factory.forUri(uri); | 209 Source source = factory.forUri(uri); |
| 214 changeSet.addedSource(source); | 210 changeSet.addedSource(source); |
| 215 } | 211 } |
| 216 _analysisContext.applyChanges(changeSet); | 212 _analysisContext.applyChanges(changeSet); |
| 217 } | 213 } |
| 218 return _analysisContext; | 214 return _analysisContext; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 bool get isInternal => throw unimplemented; | 319 bool get isInternal => throw unimplemented; |
| 324 | 320 |
| 325 @override | 321 @override |
| 326 bool get isShared => throw unimplemented; | 322 bool get isShared => throw unimplemented; |
| 327 | 323 |
| 328 @override | 324 @override |
| 329 bool get isVmLibrary => throw unimplemented; | 325 bool get isVmLibrary => throw unimplemented; |
| 330 | 326 |
| 331 UnimplementedError get unimplemented => new UnimplementedError(); | 327 UnimplementedError get unimplemented => new UnimplementedError(); |
| 332 } | 328 } |
| OLD | NEW |