| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/analysis/results.dart'; | 7 import 'package:analyzer/dart/analysis/results.dart'; |
| 8 import 'package:analyzer/dart/analysis/session.dart'; | 8 import 'package:analyzer/dart/analysis/session.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/dart/analysis/driver.dart' as driver; | 10 import 'package:analyzer/src/dart/analysis/driver.dart' as driver; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 * The type system being used by the analysis driver. | 30 * The type system being used by the analysis driver. |
| 31 */ | 31 */ |
| 32 TypeSystem _typeSystem; | 32 TypeSystem _typeSystem; |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Initialize a newly created analysis session. | 35 * Initialize a newly created analysis session. |
| 36 */ | 36 */ |
| 37 AnalysisSessionImpl(this._driver); | 37 AnalysisSessionImpl(this._driver); |
| 38 | 38 |
| 39 @override | 39 @override |
| 40 SourceFactory get sourceFactory => _driver.sourceFactory; |
| 41 |
| 42 @override |
| 40 Future<TypeProvider> get typeProvider async { | 43 Future<TypeProvider> get typeProvider async { |
| 41 _checkConsistency(); | 44 _checkConsistency(); |
| 42 if (_typeProvider == null) { | 45 if (_typeProvider == null) { |
| 43 LibraryElement coreLibrary = await _driver.getLibraryByUri('dart:core'); | 46 LibraryElement coreLibrary = await _driver.getLibraryByUri('dart:core'); |
| 44 LibraryElement asyncLibrary = await _driver.getLibraryByUri('dart:async'); | 47 LibraryElement asyncLibrary = await _driver.getLibraryByUri('dart:async'); |
| 45 _typeProvider = new TypeProviderImpl(coreLibrary, asyncLibrary); | 48 _typeProvider = new TypeProviderImpl(coreLibrary, asyncLibrary); |
| 46 } | 49 } |
| 47 return _typeProvider; | 50 return _typeProvider; |
| 48 } | 51 } |
| 49 | 52 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 /** | 115 /** |
| 113 * Check to see that results from this session will be consistent, and throw | 116 * Check to see that results from this session will be consistent, and throw |
| 114 * an [InconsistentAnalysisException] if they might not be. | 117 * an [InconsistentAnalysisException] if they might not be. |
| 115 */ | 118 */ |
| 116 void _checkConsistency() { | 119 void _checkConsistency() { |
| 117 if (_driver.currentSession != this) { | 120 if (_driver.currentSession != this) { |
| 118 throw new InconsistentAnalysisException(); | 121 throw new InconsistentAnalysisException(); |
| 119 } | 122 } |
| 120 } | 123 } |
| 121 } | 124 } |
| OLD | NEW |