OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 * The set of explicitly analyzed files. | 119 * The set of explicitly analyzed files. |
120 */ | 120 */ |
121 final _explicitFiles = new LinkedHashSet<String>(); | 121 final _explicitFiles = new LinkedHashSet<String>(); |
122 | 122 |
123 /** | 123 /** |
124 * The set of files that are currently scheduled for analysis. | 124 * The set of files that are currently scheduled for analysis. |
125 */ | 125 */ |
126 final _filesToAnalyze = new LinkedHashSet<String>(); | 126 final _filesToAnalyze = new LinkedHashSet<String>(); |
127 | 127 |
128 /** | 128 /** |
129 * The mapping of [Uri]s to the mapping of textual URIs to the [Source] | |
130 * that correspond in the current [_sourceFactory]. | |
Paul Berry
2016/10/24 12:00:48
I'm having trouble parsing this comment. Consider
scheglov
2016/10/24 17:51:34
Done.
Thank you.
| |
131 */ | |
132 final _uriResolutionCache = <Uri, Map<String, Source>>{}; | |
133 | |
134 /** | |
129 * The current file state. | 135 * The current file state. |
130 * | 136 * |
131 * It maps file paths to the MD5 hash of the file content. | 137 * It maps file paths to the MD5 hash of the file content. |
132 */ | 138 */ |
133 final _fileContentHashMap = <String, String>{}; | 139 final _fileContentHashMap = <String, String>{}; |
134 | 140 |
135 /** | 141 /** |
136 * Mapping from library URIs to the linked hash of the library. | 142 * Mapping from library URIs to the linked hash of the library. |
137 */ | 143 */ |
138 final _linkedHashMap = <Uri, String>{}; | 144 final _linkedHashMap = <Uri, String>{}; |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
800 | 806 |
801 return _unit; | 807 return _unit; |
802 } | 808 } |
803 | 809 |
804 Uri get uri => source.uri; | 810 Uri get uri => source.uri; |
805 | 811 |
806 /** | 812 /** |
807 * Return the [_File] for the [uri] referenced in this file. | 813 * Return the [_File] for the [uri] referenced in this file. |
808 */ | 814 */ |
809 _File resolveUri(String uri) { | 815 _File resolveUri(String uri) { |
810 Source uriSource = driver._sourceFactory.resolveUri(source, uri); | 816 Source uriSource = driver._uriResolutionCache |
817 .putIfAbsent(this.uri, () => <String, Source>{}) | |
818 .putIfAbsent(uri, () => driver._sourceFactory.resolveUri(source, uri)); | |
Paul Berry
2016/10/24 12:00:48
This seems like a rather minor optimization compar
scheglov
2016/10/24 17:51:34
I agree about unnecessary optimizations.
Adding TO
| |
811 return new _File(driver, uriSource); | 819 return new _File(driver, uriSource); |
812 } | 820 } |
813 | 821 |
814 @override | 822 @override |
815 String toString() => uri.toString(); | 823 String toString() => uri.toString(); |
816 | 824 |
817 /** | 825 /** |
818 * Fill the [_content] and [_contentHash] fields. | 826 * Fill the [_content] and [_contentHash] fields. |
819 * | 827 * |
820 * If the [_content] field if it is still `null`, get the content from the | 828 * If the [_content] field if it is still `null`, get the content from the |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
940 } | 948 } |
941 } | 949 } |
942 | 950 |
943 appendDependencies(this); | 951 appendDependencies(this); |
944 } | 952 } |
945 } | 953 } |
946 | 954 |
947 @override | 955 @override |
948 String toString() => uri.toString(); | 956 String toString() => uri.toString(); |
949 } | 957 } |
OLD | NEW |