@@ -416,8 +416,19 @@ class AliasSpec extends @aliasspec, TypeSpec { }
416
416
class TypeDefSpec extends @typedefspec, TypeSpec { }
417
417
418
418
/**
419
- * A field declaration, of a struct, a function (in which case this is a parameter or result variable),
420
- * or an interface (in which case this is a method or embedding spec).
419
+ * A field declaration, in a struct, a function (for parameter or result
420
+ * variables), or an interface (in which case this is a method or embedding
421
+ * spec).
422
+ *
423
+ * Examples:
424
+ *
425
+ * ```go
426
+ * s string
427
+ * x, y int
428
+ * Close() error
429
+ * io.Reader
430
+ * ~int | float32
431
+ * ```
421
432
*/
422
433
class FieldBase extends @field, ExprParent {
423
434
/**
@@ -433,6 +444,13 @@ class FieldBase extends @field, ExprParent {
433
444
434
445
/**
435
446
* A field declaration in a struct type.
447
+ *
448
+ * Examples:
449
+ *
450
+ * ```go
451
+ * Name string `json:"name"`
452
+ * x, y int
453
+ * ```
436
454
*/
437
455
class FieldDecl extends FieldBase , Documentable , ExprParent {
438
456
StructTypeExpr st ;
@@ -464,6 +482,12 @@ class FieldDecl extends FieldBase, Documentable, ExprParent {
464
482
465
483
/**
466
484
* An embedded field declaration in a struct.
485
+ *
486
+ * Examples:
487
+ *
488
+ * ```go
489
+ * io.Reader
490
+ * ```
467
491
*/
468
492
class EmbeddedFieldDecl extends FieldDecl {
469
493
EmbeddedFieldDecl ( ) { not exists ( this .getNameExpr ( _) ) }
@@ -473,6 +497,13 @@ class EmbeddedFieldDecl extends FieldDecl {
473
497
474
498
/**
475
499
* A function parameter or result variable declaration.
500
+ *
501
+ * Examples:
502
+ *
503
+ * ```go
504
+ * name string
505
+ * x, y int
506
+ * ```
476
507
*/
477
508
class ParameterOrResultDecl extends FieldBase , Documentable , ExprParent {
478
509
int rawIndex ;
@@ -507,6 +538,13 @@ class ParameterOrResultDecl extends FieldBase, Documentable, ExprParent {
507
538
508
539
/**
509
540
* A parameter declaration.
541
+ *
542
+ * Examples:
543
+ *
544
+ * ```go
545
+ * name string
546
+ * x, y int
547
+ * ```
510
548
*/
511
549
class ParameterDecl extends ParameterOrResultDecl {
512
550
ParameterDecl ( ) { rawIndex >= 0 }
@@ -524,6 +562,13 @@ class ParameterDecl extends ParameterOrResultDecl {
524
562
525
563
/**
526
564
* A receiver declaration in a function declaration.
565
+ *
566
+ * Examples:
567
+ *
568
+ * ```go
569
+ * p *Point
570
+ * r io.Reader
571
+ * ```
527
572
*/
528
573
class ReceiverDecl extends FieldBase , Documentable , ExprParent {
529
574
FuncDecl fd ;
@@ -547,6 +592,14 @@ class ReceiverDecl extends FieldBase, Documentable, ExprParent {
547
592
548
593
/**
549
594
* A result variable declaration.
595
+ *
596
+ * Examples:
597
+ *
598
+ * ```go
599
+ * error
600
+ * r io.Reader
601
+ * x, y int
602
+ * ```
550
603
*/
551
604
class ResultVariableDecl extends ParameterOrResultDecl {
552
605
ResultVariableDecl ( ) { rawIndex < 0 }
@@ -564,6 +617,15 @@ class ResultVariableDecl extends ParameterOrResultDecl {
564
617
565
618
/**
566
619
* A type parameter declaration in a type specification.
620
+ *
621
+ * Examples:
622
+ *
623
+ * ```go
624
+ * T any
625
+ * S, T comparable
626
+ * K ~int32 | float32
627
+ * _ any
628
+ * ```
567
629
*/
568
630
class TypeParamDecl extends @typeparamdecl, Documentable , ExprParent {
569
631
TypeParamDecl ( ) { typeparamdecls ( this , _, _) }
@@ -615,6 +677,14 @@ class TypeParamDecl extends @typeparamdecl, Documentable, ExprParent {
615
677
616
678
/**
617
679
* A method or embedding specification in an interface type expression.
680
+ *
681
+ * Examples:
682
+ *
683
+ * ```go
684
+ * Read([]byte) (int, error)
685
+ * io.Reader
686
+ * ~int32 | float32
687
+ * ```
618
688
*/
619
689
class InterfaceMemberSpec extends FieldBase , Documentable , ExprParent {
620
690
InterfaceTypeExpr ite ;
@@ -636,6 +706,12 @@ class InterfaceMemberSpec extends FieldBase, Documentable, ExprParent {
636
706
637
707
/**
638
708
* A method specification in an interface.
709
+ *
710
+ * Examples:
711
+ *
712
+ * ```go
713
+ * Read([]byte) (int, error)
714
+ * ```
639
715
*/
640
716
class MethodSpec extends InterfaceMemberSpec {
641
717
Expr name ;
@@ -654,6 +730,13 @@ class MethodSpec extends InterfaceMemberSpec {
654
730
655
731
/**
656
732
* An embedding specification in an interface.
733
+ *
734
+ * Examples:
735
+ *
736
+ * ```go
737
+ * io.Reader
738
+ * ~int32 | float32
739
+ * ```
657
740
*/
658
741
class EmbeddingSpec extends InterfaceMemberSpec {
659
742
EmbeddingSpec ( ) { not exists ( this .getChildExpr ( 1 ) ) }
0 commit comments