Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: pkg/analyzer/lib/src/generated/sdk.dart

Issue 2577943003: Use AnalysisOptions.signature as a way to check compatibility. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/package.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.generated.sdk; 5 library analyzer.src.generated.sdk;
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/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
11 import 'package:analyzer/src/generated/engine.dart' 11 import 'package:analyzer/src/generated/engine.dart'
12 show AnalysisContext, AnalysisOptions, AnalysisOptionsImpl; 12 show AnalysisContext, AnalysisOptions;
13 import 'package:analyzer/src/generated/source.dart' show Source; 13 import 'package:analyzer/src/generated/source.dart' show Source;
14 import 'package:analyzer/src/generated/utilities_general.dart'; 14 import 'package:analyzer/src/generated/utilities_general.dart';
15 import 'package:analyzer/src/summary/idl.dart' show PackageBundle; 15 import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
16 16
17 /** 17 /**
18 * A Dart SDK installed in a specified location. 18 * A Dart SDK installed in a specified location.
19 */ 19 */
20 abstract class DartSdk { 20 abstract class DartSdk {
21 /** 21 /**
22 * The short name of the dart SDK 'async' library. 22 * The short name of the dart SDK 'async' library.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 /** 206 /**
207 * Initialize a newly created SDK description to describe an SDK based on the 207 * Initialize a newly created SDK description to describe an SDK based on the
208 * files or directories at the given [paths] that is analyzed using the given 208 * files or directories at the given [paths] that is analyzed using the given
209 * [options]. 209 * [options].
210 */ 210 */
211 SdkDescription(this.paths, this.options); 211 SdkDescription(this.paths, this.options);
212 212
213 @override 213 @override
214 int get hashCode { 214 int get hashCode {
215 int hashCode = 0; 215 int hashCode = 0;
216 for (int value in options.encodeCrossContextOptions()) { 216 for (int value in options.signature) {
217 hashCode = JenkinsSmiHash.combine(hashCode, value); 217 hashCode = JenkinsSmiHash.combine(hashCode, value);
218 } 218 }
219 for (String path in paths) { 219 for (String path in paths) {
220 hashCode = JenkinsSmiHash.combine(hashCode, path.hashCode); 220 hashCode = JenkinsSmiHash.combine(hashCode, path.hashCode);
221 } 221 }
222 return JenkinsSmiHash.finish(hashCode); 222 return JenkinsSmiHash.finish(hashCode);
223 } 223 }
224 224
225 @override 225 @override
226 bool operator ==(Object other) { 226 bool operator ==(Object other) {
227 if (other is SdkDescription) { 227 if (other is SdkDescription) {
228 if (!AnalysisOptions.crossContextOptionsEqual( 228 if (!AnalysisOptions.signaturesEqual(
229 options.encodeCrossContextOptions(), 229 options.signature, other.options.signature)) {
230 other.options.encodeCrossContextOptions())) {
231 return false; 230 return false;
232 } 231 }
233 int length = paths.length; 232 int length = paths.length;
234 if (other.paths.length != length) { 233 if (other.paths.length != length) {
235 return false; 234 return false;
236 } 235 }
237 for (int i = 0; i < length; i++) { 236 for (int i = 0; i < length; i++) {
238 if (other.paths[i] != paths[i]) { 237 if (other.paths[i] != paths[i]) {
239 return false; 238 return false;
240 } 239 }
(...skipping 15 matching lines...) Expand all
256 needsSeparator = true; 255 needsSeparator = true;
257 } 256 }
258 257
259 for (String path in paths) { 258 for (String path in paths) {
260 add(path); 259 add(path);
261 } 260 }
262 if (needsSeparator) { 261 if (needsSeparator) {
263 buffer.write(' '); 262 buffer.write(' ');
264 } 263 }
265 buffer.write('('); 264 buffer.write('(');
266 buffer.write(AnalysisOptionsImpl 265 buffer.write(options.signature);
267 .decodeCrossContextOptions(options.encodeCrossContextOptions()));
268 buffer.write(')'); 266 buffer.write(')');
269 return buffer.toString(); 267 return buffer.toString();
270 } 268 }
271 } 269 }
272 270
273 class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<Object> { 271 class SdkLibrariesReader_LibraryBuilder extends RecursiveAstVisitor<Object> {
274 /** 272 /**
275 * The prefix added to the name of a library to form the URI used in code to 273 * The prefix added to the name of a library to form the URI used in code to
276 * reference the library. 274 * reference the library.
277 */ 275 */
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 _platforms |= DART2JS_PLATFORM; 538 _platforms |= DART2JS_PLATFORM;
541 } 539 }
542 540
543 /** 541 /**
544 * Record that this library can be run on the VM. 542 * Record that this library can be run on the VM.
545 */ 543 */
546 void setVmLibrary() { 544 void setVmLibrary() {
547 _platforms |= VM_PLATFORM; 545 _platforms |= VM_PLATFORM;
548 } 546 }
549 } 547 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/package.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698