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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 bool _contains(List<Source> sources, Source targetSource) { | 1304 bool _contains(List<Source> sources, Source targetSource) { |
1305 for (Source source in sources) { | 1305 for (Source source in sources) { |
1306 if (source == targetSource) { | 1306 if (source == targetSource) { |
1307 return true; | 1307 return true; |
1308 } | 1308 } |
1309 } | 1309 } |
1310 return false; | 1310 return false; |
1311 } | 1311 } |
1312 | 1312 |
1313 /** | 1313 /** |
1314 * Return `true` if the given list of [sources] contains any of the given | |
1315 * [targetSources]. | |
1316 */ | |
1317 bool _containsAny(List<Source> sources, List<Source> targetSources) { | |
1318 for (Source targetSource in targetSources) { | |
1319 if (_contains(sources, targetSource)) { | |
1320 return true; | |
1321 } | |
1322 } | |
1323 return false; | |
1324 } | |
1325 | |
1326 /** | |
1327 * Set the contents of the given [source] to the given [contents] and mark the | 1314 * Set the contents of the given [source] to the given [contents] and mark the |
1328 * source as having changed. The additional [offset], [oldLength] and | 1315 * source as having changed. The additional [offset], [oldLength] and |
1329 * [newLength] information is used by the context to determine what reanalysis | 1316 * [newLength] information is used by the context to determine what reanalysis |
1330 * is necessary. The method [setChangedContents] triggers a source changed | 1317 * is necessary. The method [setChangedContents] triggers a source changed |
1331 * event where as this method does not. | 1318 * event where as this method does not. |
1332 */ | 1319 */ |
1333 bool _contentRangeChanged(Source source, String contents, int offset, | 1320 bool _contentRangeChanged(Source source, String contents, int offset, |
1334 int oldLength, int newLength) { | 1321 int oldLength, int newLength) { |
1335 bool changed = false; | 1322 bool changed = false; |
1336 String originalContents = _contentCache.setContents(source, contents); | 1323 String originalContents = _contentCache.setContents(source, contents); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 PendingFuture pendingFuture = | 1989 PendingFuture pendingFuture = |
2003 new PendingFuture<T>(_context, target, computeValue); | 1990 new PendingFuture<T>(_context, target, computeValue); |
2004 if (!pendingFuture.evaluate(entry)) { | 1991 if (!pendingFuture.evaluate(entry)) { |
2005 _context._pendingFutureTargets | 1992 _context._pendingFutureTargets |
2006 .putIfAbsent(target, () => <PendingFuture>[]) | 1993 .putIfAbsent(target, () => <PendingFuture>[]) |
2007 .add(pendingFuture); | 1994 .add(pendingFuture); |
2008 } | 1995 } |
2009 return pendingFuture.future; | 1996 return pendingFuture.future; |
2010 } | 1997 } |
2011 } | 1998 } |
OLD | NEW |