| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.src.context.context; | 5 library analyzer.src.context.context; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/instrumentation/instrumentation.dart'; | 10 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 */ | 154 */ |
| 155 HashMap<Source, ChangeNoticeImpl> _pendingNotices = | 155 HashMap<Source, ChangeNoticeImpl> _pendingNotices = |
| 156 new HashMap<Source, ChangeNoticeImpl>(); | 156 new HashMap<Source, ChangeNoticeImpl>(); |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * The [TypeProvider] for this context, `null` if not yet created. | 159 * The [TypeProvider] for this context, `null` if not yet created. |
| 160 */ | 160 */ |
| 161 TypeProvider _typeProvider; | 161 TypeProvider _typeProvider; |
| 162 | 162 |
| 163 /** | 163 /** |
| 164 * The [TypeSystem] for this context, `null` if not yet created. |
| 165 */ |
| 166 TypeSystem _typeSystem; |
| 167 |
| 168 /** |
| 164 * The controller for sending [SourcesChangedEvent]s. | 169 * The controller for sending [SourcesChangedEvent]s. |
| 165 */ | 170 */ |
| 166 StreamController<SourcesChangedEvent> _onSourcesChangedController; | 171 StreamController<SourcesChangedEvent> _onSourcesChangedController; |
| 167 | 172 |
| 168 /** | 173 /** |
| 169 * A subscription for a stream of events indicating when files are (and are | 174 * A subscription for a stream of events indicating when files are (and are |
| 170 * not) being implicitly analyzed. | 175 * not) being implicitly analyzed. |
| 171 */ | 176 */ |
| 172 StreamController<ImplicitAnalysisEvent> _implicitAnalysisEventsController; | 177 StreamController<ImplicitAnalysisEvent> _implicitAnalysisEventsController; |
| 173 | 178 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 477 } |
| 473 | 478 |
| 474 /** | 479 /** |
| 475 * Sets the [TypeProvider] for this context. | 480 * Sets the [TypeProvider] for this context. |
| 476 */ | 481 */ |
| 477 void set typeProvider(TypeProvider typeProvider) { | 482 void set typeProvider(TypeProvider typeProvider) { |
| 478 _typeProvider = typeProvider; | 483 _typeProvider = typeProvider; |
| 479 } | 484 } |
| 480 | 485 |
| 481 @override | 486 @override |
| 487 TypeSystem get typeSystem { |
| 488 if (_typeSystem == null) { |
| 489 _typeSystem = new TypeSystemImpl(typeProvider); |
| 490 } |
| 491 return _typeSystem; |
| 492 } |
| 493 |
| 494 @override |
| 482 void addListener(AnalysisListener listener) { | 495 void addListener(AnalysisListener listener) { |
| 483 if (!_listeners.contains(listener)) { | 496 if (!_listeners.contains(listener)) { |
| 484 _listeners.add(listener); | 497 _listeners.add(listener); |
| 485 } | 498 } |
| 486 } | 499 } |
| 487 | 500 |
| 488 @override | 501 @override |
| 489 void applyAnalysisDelta(AnalysisDelta delta) { | 502 void applyAnalysisDelta(AnalysisDelta delta) { |
| 490 ChangeSet changeSet = new ChangeSet(); | 503 ChangeSet changeSet = new ChangeSet(); |
| 491 delta.analysisLevels.forEach((Source source, AnalysisLevel level) { | 504 delta.analysisLevels.forEach((Source source, AnalysisLevel level) { |
| (...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 new PendingFuture<T>(_context, target, computeValue); | 2107 new PendingFuture<T>(_context, target, computeValue); |
| 2095 if (!pendingFuture.evaluate(entry)) { | 2108 if (!pendingFuture.evaluate(entry)) { |
| 2096 _context._pendingFutureTargets | 2109 _context._pendingFutureTargets |
| 2097 .putIfAbsent(target, () => <PendingFuture>[]) | 2110 .putIfAbsent(target, () => <PendingFuture>[]) |
| 2098 .add(pendingFuture); | 2111 .add(pendingFuture); |
| 2099 scheduleComputation(); | 2112 scheduleComputation(); |
| 2100 } | 2113 } |
| 2101 return pendingFuture.future; | 2114 return pendingFuture.future; |
| 2102 } | 2115 } |
| 2103 } | 2116 } |
| OLD | NEW |