| 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:typed_data'; | 7 import 'dart:typed_data'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 final _LibraryNode node; | 1132 final _LibraryNode node; |
| 1133 final SummaryDataStore store; | 1133 final SummaryDataStore store; |
| 1134 _LibraryContext(this.file, this.node, this.store); | 1134 _LibraryContext(this.file, this.node, this.store); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 class _LibraryNode { | 1137 class _LibraryNode { |
| 1138 final AnalysisDriver driver; | 1138 final AnalysisDriver driver; |
| 1139 final FileState file; | 1139 final FileState file; |
| 1140 final Uri uri; | 1140 final Uri uri; |
| 1141 | 1141 |
| 1142 Set<FileState> transitiveDependencies; | |
| 1143 String _dependencySignature; | 1142 String _dependencySignature; |
| 1144 | 1143 |
| 1145 _LibraryNode(this.driver, this.file, this.uri); | 1144 _LibraryNode(this.driver, this.file, this.uri); |
| 1146 | 1145 |
| 1147 String get dependencySignature { | 1146 String get dependencySignature { |
| 1148 return _dependencySignature ??= | 1147 return _dependencySignature ??= |
| 1149 driver._dependencySignatureMap.putIfAbsent(uri, () { | 1148 driver._dependencySignatureMap.putIfAbsent(uri, () { |
| 1150 ApiSignature signature = new ApiSignature(); | 1149 ApiSignature signature = new ApiSignature(); |
| 1151 signature.addUint32List(driver._salt); | 1150 signature.addUint32List(driver._salt); |
| 1152 signature.addString(driver._sdkBundle.apiSignature); | 1151 signature.addString(driver._sdkBundle.apiSignature); |
| 1153 | 1152 |
| 1154 // Add all unlinked API signatures. | 1153 // Add all unlinked API signatures. |
| 1155 computeTransitiveDependencies(); | 1154 file.transitiveFiles |
| 1156 transitiveDependencies | |
| 1157 .map((file) => file.apiSignature) | 1155 .map((file) => file.apiSignature) |
| 1158 .forEach(signature.addBytes); | 1156 .forEach(signature.addBytes); |
| 1159 | 1157 |
| 1160 // Combine into a single hash. | 1158 // Combine into a single hash. |
| 1161 signature.addString(uri.toString()); | 1159 signature.addString(uri.toString()); |
| 1162 return signature.toHex(); | 1160 return signature.toHex(); |
| 1163 }); | 1161 }); |
| 1164 } | 1162 } |
| 1165 | 1163 |
| 1166 @override | 1164 @override |
| 1167 int get hashCode => uri.hashCode; | 1165 int get hashCode => uri.hashCode; |
| 1168 | 1166 |
| 1169 bool operator ==(other) { | 1167 bool operator ==(other) { |
| 1170 return other is _LibraryNode && other.uri == uri; | 1168 return other is _LibraryNode && other.uri == uri; |
| 1171 } | 1169 } |
| 1172 | 1170 |
| 1173 void computeTransitiveDependencies() { | |
| 1174 if (transitiveDependencies == null) { | |
| 1175 transitiveDependencies = new Set<FileState>(); | |
| 1176 | |
| 1177 void appendDependencies(FileState file) { | |
| 1178 if (transitiveDependencies.add(file)) { | |
| 1179 file.dependencies.forEach(appendDependencies); | |
| 1180 } | |
| 1181 } | |
| 1182 | |
| 1183 appendDependencies(file); | |
| 1184 } | |
| 1185 } | |
| 1186 | |
| 1187 @override | 1171 @override |
| 1188 String toString() => uri.toString(); | 1172 String toString() => uri.toString(); |
| 1189 } | 1173 } |
| OLD | NEW |