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

Side by Side Diff: lib/info.dart

Issue 1535893002: Change the deferred library check tool to allow unspecified packages to be in (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: Created 5 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
OLDNEW
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 /// Data produced by dart2js when run with the `--dump-info` flag. 5 /// Data produced by dart2js when run with the `--dump-info` flag.
6 library dart2js_info.info; 6 library dart2js_info.info;
7 7
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'src/measurements.dart'; 10 import 'src/measurements.dart';
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 /// Common information used for most kind of elements. 45 /// Common information used for most kind of elements.
46 // TODO(sigmund): add more: 46 // TODO(sigmund): add more:
47 // - inputSize: bytes used in the Dart source program 47 // - inputSize: bytes used in the Dart source program
48 abstract class BasicInfo implements Info { 48 abstract class BasicInfo implements Info {
49 final InfoKind kind; 49 final InfoKind kind;
50 final int id; 50 final int id;
51 String coverageId; 51 String coverageId;
52 int size; 52 int size;
53 Info parent; 53 Info parent;
54 54
55 String get serializedId => '${_kindToString(kind)}/$id'; 55 String get serializedId => '${kindToString(kind)}/$id';
56 56
57 String name; 57 String name;
58 58
59 /// If using deferred libraries, where the element associated with this info 59 /// If using deferred libraries, where the element associated with this info
60 /// is generated. 60 /// is generated.
61 OutputUnitInfo outputUnit; 61 OutputUnitInfo outputUnit;
62 62
63 BasicInfo(this.kind, this.id, this.name, this.outputUnit, this.size, 63 BasicInfo(this.kind, this.id, this.name, this.outputUnit, this.size,
64 this.coverageId); 64 this.coverageId);
65 65
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 enum InfoKind { 412 enum InfoKind {
413 library, 413 library,
414 clazz, 414 clazz,
415 function, 415 function,
416 field, 416 field,
417 constant, 417 constant,
418 outputUnit, 418 outputUnit,
419 typedef, 419 typedef,
420 } 420 }
421 421
422 String _kindToString(InfoKind kind) { 422 String kindToString(InfoKind kind) {
423 switch (kind) { 423 switch (kind) {
424 case InfoKind.library: 424 case InfoKind.library:
425 return 'library'; 425 return 'library';
426 case InfoKind.clazz: 426 case InfoKind.clazz:
427 return 'class'; 427 return 'class';
428 case InfoKind.function: 428 case InfoKind.function:
429 return 'function'; 429 return 'function';
430 case InfoKind.field: 430 case InfoKind.field:
431 return 'field'; 431 return 'field';
432 case InfoKind.constant: 432 case InfoKind.constant:
433 return 'constant'; 433 return 'constant';
434 case InfoKind.outputUnit: 434 case InfoKind.outputUnit:
435 return 'outputUnit'; 435 return 'outputUnit';
436 case InfoKind.typedef: 436 case InfoKind.typedef:
437 return 'typedef'; 437 return 'typedef';
438 default: 438 default:
439 return null; 439 return null;
440 } 440 }
441 } 441 }
442 442
443 int _idFromSerializedId(String serializedId) => 443 int _idFromSerializedId(String serializedId) =>
444 int.parse(serializedId.substring(serializedId.indexOf('/') + 1)); 444 int.parse(serializedId.substring(serializedId.indexOf('/') + 1));
445 445
446 InfoKind _kindFromSerializedId(String serializedId) => 446 InfoKind _kindFromSerializedId(String serializedId) =>
447 _kindFromString(serializedId.substring(0, serializedId.indexOf('/'))); 447 kindFromString(serializedId.substring(0, serializedId.indexOf('/')));
448 448
449 InfoKind _kindFromString(String kind) { 449 InfoKind kindFromString(String kind) {
450 switch (kind) { 450 switch (kind) {
451 case 'library': 451 case 'library':
452 return InfoKind.library; 452 return InfoKind.library;
453 case 'class': 453 case 'class':
454 return InfoKind.clazz; 454 return InfoKind.clazz;
455 case 'function': 455 case 'function':
456 return InfoKind.function; 456 return InfoKind.function;
457 case 'field': 457 case 'field':
458 return InfoKind.field; 458 return InfoKind.field;
459 case 'constant': 459 case 'constant':
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 514
515 visitConstant(ConstantInfo info) {} 515 visitConstant(ConstantInfo info) {}
516 516
517 visitFunction(FunctionInfo info) { 517 visitFunction(FunctionInfo info) {
518 info.closures.forEach(visitFunction); 518 info.closures.forEach(visitFunction);
519 } 519 }
520 520
521 visitTypedef(TypedefInfo info) {} 521 visitTypedef(TypedefInfo info) {}
522 visitOutput(OutputUnitInfo info) {} 522 visitOutput(OutputUnitInfo info) {}
523 } 523 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698