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

Side by Side Diff: pkg/analyzer/tool/summary/idl.dart

Issue 1569033002: Add Element.nameOffset and LibraryElement.nameLength to summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months 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/test/src/summary/summary_test.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) 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 /** 5 /**
6 * This file is an "idl" style description of the summary format. It is not 6 * This file is an "idl" style description of the summary format. It is not
7 * executed directly; instead it is parsed and transformed into code that 7 * executed directly; instead it is parsed and transformed into code that
8 * implements the summary format. 8 * implements the summary format.
9 * 9 *
10 * The code generation process introduces the following non-typical semantics: 10 * The code generation process introduces the following non-typical semantics:
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 /** 209 /**
210 * Unlinked summary information about a class declaration. 210 * Unlinked summary information about a class declaration.
211 */ 211 */
212 class UnlinkedClass { 212 class UnlinkedClass {
213 /** 213 /**
214 * Name of the class. 214 * Name of the class.
215 */ 215 */
216 String name; 216 String name;
217 217
218 /** 218 /**
219 * Offset of the class name relative to the beginning of the file.
220 */
221 @informative
222 int nameOffset;
223
224 /**
219 * Type parameters of the class, if any. 225 * Type parameters of the class, if any.
220 */ 226 */
221 List<UnlinkedTypeParam> typeParameters; 227 List<UnlinkedTypeParam> typeParameters;
222 228
223 /** 229 /**
224 * Supertype of the class, or `null` if either (a) the class doesn't 230 * Supertype of the class, or `null` if either (a) the class doesn't
225 * explicitly declare a supertype (and hence has supertype `Object`), or (b) 231 * explicitly declare a supertype (and hence has supertype `Object`), or (b)
226 * the class *is* `Object` (and hence has no supertype). 232 * the class *is* `Object` (and hence has no supertype).
227 */ 233 */
228 UnlinkedTypeRef supertype; 234 UnlinkedTypeRef supertype;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 /** 289 /**
284 * Unlinked summary information about an enum declaration. 290 * Unlinked summary information about an enum declaration.
285 */ 291 */
286 class UnlinkedEnum { 292 class UnlinkedEnum {
287 /** 293 /**
288 * Name of the enum type. 294 * Name of the enum type.
289 */ 295 */
290 String name; 296 String name;
291 297
292 /** 298 /**
299 * Offset of the enum name relative to the beginning of the file.
300 */
301 @informative
302 int nameOffset;
303
304 /**
293 * Values listed in the enum declaration, in declaration order. 305 * Values listed in the enum declaration, in declaration order.
294 */ 306 */
295 List<UnlinkedEnumValue> values; 307 List<UnlinkedEnumValue> values;
296 } 308 }
297 309
298 /** 310 /**
299 * Unlinked summary information about a single enumerated value in an enum 311 * Unlinked summary information about a single enumerated value in an enum
300 * declaration. 312 * declaration.
301 */ 313 */
302 class UnlinkedEnumValue { 314 class UnlinkedEnumValue {
303 /** 315 /**
304 * Name of the enumerated value. 316 * Name of the enumerated value.
305 */ 317 */
306 String name; 318 String name;
319
320 /**
321 * Offset of the enum value name relative to the beginning of the file.
322 */
323 @informative
324 int nameOffset;
307 } 325 }
308 326
309 /** 327 /**
310 * Unlinked summary information about a function, method, getter, or setter 328 * Unlinked summary information about a function, method, getter, or setter
311 * declaration. 329 * declaration.
312 */ 330 */
313 class UnlinkedExecutable { 331 class UnlinkedExecutable {
314 /** 332 /**
315 * Name of the executable. For setters, this includes the trailing "=". For 333 * Name of the executable. For setters, this includes the trailing "=". For
316 * named constructors, this excludes the class name and excludes the ".". 334 * named constructors, this excludes the class name and excludes the ".".
317 * For unnamed constructors, this is the empty string. 335 * For unnamed constructors, this is the empty string.
318 */ 336 */
319 String name; 337 String name;
320 338
321 /** 339 /**
340 * Offset of the executable name relative to the beginning of the file. For
341 * named constructors, this excludes the class name and excludes the ".".
342 * For unnamed constructors, this is the offset of the class name (i.e. the
343 * offset of the second "C" in "class C { C(); }").
344 */
345 @informative
346 int nameOffset;
347
348 /**
322 * Type parameters of the executable, if any. Empty if support for generic 349 * Type parameters of the executable, if any. Empty if support for generic
323 * method syntax is disabled. 350 * method syntax is disabled.
324 */ 351 */
325 List<UnlinkedTypeParam> typeParameters; 352 List<UnlinkedTypeParam> typeParameters;
326 353
327 /** 354 /**
328 * Declared return type of the executable. Absent if the return type is 355 * Declared return type of the executable. Absent if the return type is
329 * `void` or the executable is a constructor. Note that when strong mode is 356 * `void` or the executable is a constructor. Note that when strong mode is
330 * enabled, the actual return type may be different due to type inference. 357 * enabled, the actual return type may be different due to type inference.
331 */ 358 */
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 */ 431 */
405 constructor 432 constructor
406 } 433 }
407 434
408 /** 435 /**
409 * Unlinked summary information about an export declaration (stored outside 436 * Unlinked summary information about an export declaration (stored outside
410 * [UnlinkedPublicNamespace]). 437 * [UnlinkedPublicNamespace]).
411 */ 438 */
412 class UnlinkedExportNonPublic { 439 class UnlinkedExportNonPublic {
413 /** 440 /**
441 * Offset of the "export" keyword.
442 */
443 @informative
444 int offset;
445
446 /**
414 * Offset of the URI string (including quotes) relative to the beginning of 447 * Offset of the URI string (including quotes) relative to the beginning of
415 * the file. 448 * the file.
416 */ 449 */
417 @informative 450 @informative
418 int uriOffset; 451 int uriOffset;
419 452
420 /** 453 /**
421 * End of the URI string (including quotes) relative to the beginning of the 454 * End of the URI string (including quotes) relative to the beginning of the
422 * file. 455 * file.
423 */ 456 */
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 */ 519 */
487 @informative 520 @informative
488 int uriOffset; 521 int uriOffset;
489 522
490 /** 523 /**
491 * End of the URI string (including quotes) relative to the beginning of the 524 * End of the URI string (including quotes) relative to the beginning of the
492 * file. If [isImplicit] is true, zero. 525 * file. If [isImplicit] is true, zero.
493 */ 526 */
494 @informative 527 @informative
495 int uriEnd; 528 int uriEnd;
529
530 /**
531 * Offset of the prefix name relative to the beginning of the file, or zero
532 * if there is no prefix.
533 */
534 @informative
535 int prefixOffset;
496 } 536 }
497 537
498 /** 538 /**
499 * Unlinked summary information about a function parameter. 539 * Unlinked summary information about a function parameter.
500 */ 540 */
501 class UnlinkedParam { 541 class UnlinkedParam {
502 /** 542 /**
503 * Name of the parameter. 543 * Name of the parameter.
504 */ 544 */
505 String name; 545 String name;
506 546
507 /** 547 /**
548 * Offset of the parameter name relative to the beginning of the file.
549 */
550 @informative
551 int nameOffset;
552
553 /**
508 * If [isFunctionTyped] is `true`, the declared return type. If 554 * If [isFunctionTyped] is `true`, the declared return type. If
509 * [isFunctionTyped] is `false`, the declared type. Absent if 555 * [isFunctionTyped] is `false`, the declared type. Absent if
510 * [isFunctionTyped] is `true` and the declared return type is `void`. Note 556 * [isFunctionTyped] is `true` and the declared return type is `void`. Note
511 * that when strong mode is enabled, the actual type may be different due to 557 * that when strong mode is enabled, the actual type may be different due to
512 * type inference. 558 * type inference.
513 */ 559 */
514 UnlinkedTypeRef type; 560 UnlinkedTypeRef type;
515 561
516 /** 562 /**
517 * If [isFunctionTyped] is `true`, the parameters of the function type. 563 * If [isFunctionTyped] is `true`, the parameters of the function type.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 /** 705 /**
660 * Unlinked summary information about a typedef declaration. 706 * Unlinked summary information about a typedef declaration.
661 */ 707 */
662 class UnlinkedTypedef { 708 class UnlinkedTypedef {
663 /** 709 /**
664 * Name of the typedef. 710 * Name of the typedef.
665 */ 711 */
666 String name; 712 String name;
667 713
668 /** 714 /**
715 * Offset of the typedef name relative to the beginning of the file.
716 */
717 @informative
718 int nameOffset;
719
720 /**
669 * Type parameters of the typedef, if any. 721 * Type parameters of the typedef, if any.
670 */ 722 */
671 List<UnlinkedTypeParam> typeParameters; 723 List<UnlinkedTypeParam> typeParameters;
672 724
673 /** 725 /**
674 * Return type of the typedef. Absent if the return type is `void`. 726 * Return type of the typedef. Absent if the return type is `void`.
675 */ 727 */
676 UnlinkedTypeRef returnType; 728 UnlinkedTypeRef returnType;
677 729
678 /** 730 /**
679 * Parameters of the executable, if any. 731 * Parameters of the executable, if any.
680 */ 732 */
681 List<UnlinkedParam> parameters; 733 List<UnlinkedParam> parameters;
682 } 734 }
683 735
684 /** 736 /**
685 * Unlinked summary information about a type parameter declaration. 737 * Unlinked summary information about a type parameter declaration.
686 */ 738 */
687 class UnlinkedTypeParam { 739 class UnlinkedTypeParam {
688 /** 740 /**
689 * Name of the type parameter. 741 * Name of the type parameter.
690 */ 742 */
691 String name; 743 String name;
692 744
693 /** 745 /**
746 * Offset of the type parameter name relative to the beginning of the file.
747 */
748 @informative
749 int nameOffset;
750
751 /**
694 * Bound of the type parameter, if a bound is explicitly declared. Otherwise 752 * Bound of the type parameter, if a bound is explicitly declared. Otherwise
695 * null. 753 * null.
696 */ 754 */
697 UnlinkedTypeRef bound; 755 UnlinkedTypeRef bound;
698 } 756 }
699 757
700 /** 758 /**
701 * Unlinked summary information about a reference to a type. 759 * Unlinked summary information about a reference to a type.
702 */ 760 */
703 class UnlinkedTypeRef { 761 class UnlinkedTypeRef {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 * Unlinked summary information about a compilation unit ("part file"). 803 * Unlinked summary information about a compilation unit ("part file").
746 */ 804 */
747 @topLevel 805 @topLevel
748 class UnlinkedUnit { 806 class UnlinkedUnit {
749 /** 807 /**
750 * Name of the library (from a "library" declaration, if present). 808 * Name of the library (from a "library" declaration, if present).
751 */ 809 */
752 String libraryName; 810 String libraryName;
753 811
754 /** 812 /**
813 * Offset of the library name relative to the beginning of the file (or 0 if
814 * the library has no name).
815 */
816 @informative
817 int libraryNameOffset;
818
819 /**
820 * Length of the library name as it appears in the source code (or 0 if the
821 * library has no name).
822 */
823 @informative
824 int libraryNameLength;
825
826 /**
755 * Unlinked public namespace of this compilation unit. 827 * Unlinked public namespace of this compilation unit.
756 */ 828 */
757 UnlinkedPublicNamespace publicNamespace; 829 UnlinkedPublicNamespace publicNamespace;
758 830
759 /** 831 /**
760 * Top level and prefixed names referred to by this compilation unit. The 832 * Top level and prefixed names referred to by this compilation unit. The
761 * zeroth element of this array is always populated and always represents a 833 * zeroth element of this array is always populated and always represents a
762 * reference to the pseudo-type "dynamic". 834 * reference to the pseudo-type "dynamic".
763 */ 835 */
764 List<UnlinkedReference> references; 836 List<UnlinkedReference> references;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 * Unlinked summary information about a top level variable, local variable, or 881 * Unlinked summary information about a top level variable, local variable, or
810 * a field. 882 * a field.
811 */ 883 */
812 class UnlinkedVariable { 884 class UnlinkedVariable {
813 /** 885 /**
814 * Name of the variable. 886 * Name of the variable.
815 */ 887 */
816 String name; 888 String name;
817 889
818 /** 890 /**
891 * Offset of the variable name relative to the beginning of the file.
892 */
893 @informative
894 int nameOffset;
895
896 /**
819 * Declared type of the variable. Note that when strong mode is enabled, the 897 * Declared type of the variable. Note that when strong mode is enabled, the
820 * actual type of the variable may be different due to type inference. 898 * actual type of the variable may be different due to type inference.
821 */ 899 */
822 UnlinkedTypeRef type; 900 UnlinkedTypeRef type;
823 901
824 /** 902 /**
825 * Indicates whether the variable is declared using the `static` keyword. 903 * Indicates whether the variable is declared using the `static` keyword.
826 * 904 *
827 * Note that for top level variables, this flag is false, since they are not 905 * Note that for top level variables, this flag is false, since they are not
828 * declared using the `static` keyword (even though they are considered 906 * declared using the `static` keyword (even though they are considered
829 * static for semantic purposes). 907 * static for semantic purposes).
830 */ 908 */
831 bool isStatic; 909 bool isStatic;
832 910
833 /** 911 /**
834 * Indicates whether the variable is declared using the `final` keyword. 912 * Indicates whether the variable is declared using the `final` keyword.
835 */ 913 */
836 bool isFinal; 914 bool isFinal;
837 915
838 /** 916 /**
839 * Indicates whether the variable is declared using the `const` keyword. 917 * Indicates whether the variable is declared using the `const` keyword.
840 */ 918 */
841 bool isConst; 919 bool isConst;
842 920
843 /** 921 /**
844 * Indicates whether this variable lacks an explicit type declaration. 922 * Indicates whether this variable lacks an explicit type declaration.
845 */ 923 */
846 bool hasImplicitType; 924 bool hasImplicitType;
847 } 925 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/summary_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698