| 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.task.dart; | 5 library analyzer.src.task.dart; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 import 'package:analyzer/src/task/strong/checker.dart'; | 42 import 'package:analyzer/src/task/strong/checker.dart'; |
| 43 import 'package:analyzer/src/task/strong_mode.dart'; | 43 import 'package:analyzer/src/task/strong_mode.dart'; |
| 44 import 'package:analyzer/task/dart.dart'; | 44 import 'package:analyzer/task/dart.dart'; |
| 45 import 'package:analyzer/task/general.dart'; | 45 import 'package:analyzer/task/general.dart'; |
| 46 import 'package:analyzer/task/model.dart'; | 46 import 'package:analyzer/task/model.dart'; |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * The [ResultCachingPolicy] for ASTs. | 49 * The [ResultCachingPolicy] for ASTs. |
| 50 */ | 50 */ |
| 51 const ResultCachingPolicy<CompilationUnit> AST_CACHING_POLICY = | 51 const ResultCachingPolicy<CompilationUnit> AST_CACHING_POLICY = |
| 52 const SimpleResultCachingPolicy(16384, 16384); | 52 const SimpleResultCachingPolicy(16384, 32); |
| 53 |
| 54 /** |
| 55 * The [ResultCachingPolicy] for fully resolved ASTs. It is separated from |
| 56 * [AST_CACHING_POLICY] because we want to keep some number of fully resolved |
| 57 * ASTs when users switch between contexts, and they should not be pushed out |
| 58 * of the cache by temporary partially resolved ASTs. |
| 59 */ |
| 60 const ResultCachingPolicy<CompilationUnit> AST_RESOLVED_CACHING_POLICY = |
| 61 const SimpleResultCachingPolicy(1024, 32); |
| 53 | 62 |
| 54 /** | 63 /** |
| 55 * The [ResultCachingPolicy] for ASTs that can be reused when a library | 64 * The [ResultCachingPolicy] for ASTs that can be reused when a library |
| 56 * on which the source depends is changed. It is worth to keep some number | 65 * on which the source depends is changed. It is worth to keep some number |
| 57 * of these ASTs in memory in order to avoid parsing sources. In contrast, | 66 * of these ASTs in memory in order to avoid parsing sources. In contrast, |
| 58 * none of [AST_CACHING_POLICY] managed ASTs can be reused after a change, so | 67 * none of [AST_CACHING_POLICY] managed ASTs can be reused after a change, so |
| 59 * it is worth to keep them in memory while analysis is being performed, but | 68 * it is worth to keep them in memory while analysis is being performed, but |
| 60 * once analysis is done, they can be flushed. | 69 * once analysis is done, they can be flushed. |
| 61 */ | 70 */ |
| 62 const ResultCachingPolicy<CompilationUnit> AST_REUSABLE_CACHING_POLICY = | 71 const ResultCachingPolicy<CompilationUnit> AST_REUSABLE_CACHING_POLICY = |
| 63 const SimpleResultCachingPolicy(1024, 1024); | 72 const SimpleResultCachingPolicy(1024, 64); |
| 64 | 73 |
| 65 /** | 74 /** |
| 66 * The [ResultCachingPolicy] for lists of [ConstantEvaluationTarget]s. | 75 * The [ResultCachingPolicy] for lists of [ConstantEvaluationTarget]s. |
| 67 */ | 76 */ |
| 68 const ResultCachingPolicy<List<ConstantEvaluationTarget>> | 77 const ResultCachingPolicy<List<ConstantEvaluationTarget>> |
| 69 CONSTANT_EVALUATION_TARGET_LIST_POLICY = | 78 CONSTANT_EVALUATION_TARGET_LIST_POLICY = |
| 70 const SimpleResultCachingPolicy(-1, -1); | 79 const SimpleResultCachingPolicy(-1, -1); |
| 71 | 80 |
| 72 /** | 81 /** |
| 73 * The [ResultCachingPolicy] for [ConstantEvaluationTarget]s. | 82 * The [ResultCachingPolicy] for [ConstantEvaluationTarget]s. |
| (...skipping 6270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6344 | 6353 |
| 6345 @override | 6354 @override |
| 6346 bool moveNext() { | 6355 bool moveNext() { |
| 6347 if (_newSources.isEmpty) { | 6356 if (_newSources.isEmpty) { |
| 6348 return false; | 6357 return false; |
| 6349 } | 6358 } |
| 6350 currentTarget = _newSources.removeLast(); | 6359 currentTarget = _newSources.removeLast(); |
| 6351 return true; | 6360 return true; |
| 6352 } | 6361 } |
| 6353 } | 6362 } |
| OLD | NEW |