@@ -416,8 +416,19 @@ class AliasSpec extends @aliasspec, TypeSpec { }
416416class TypeDefSpec extends @typedefspec, TypeSpec { }
417417
418418/**
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+ * ```
421432 */
422433class FieldBase extends @field, ExprParent {
423434 /**
@@ -433,6 +444,13 @@ class FieldBase extends @field, ExprParent {
433444
434445/**
435446 * A field declaration in a struct type.
447+ *
448+ * Examples:
449+ *
450+ * ```go
451+ * Name string `json:"name"`
452+ * x, y int
453+ * ```
436454 */
437455class FieldDecl extends FieldBase , Documentable , ExprParent {
438456 StructTypeExpr st ;
@@ -464,6 +482,12 @@ class FieldDecl extends FieldBase, Documentable, ExprParent {
464482
465483/**
466484 * An embedded field declaration in a struct.
485+ *
486+ * Examples:
487+ *
488+ * ```go
489+ * io.Reader
490+ * ```
467491 */
468492class EmbeddedFieldDecl extends FieldDecl {
469493 EmbeddedFieldDecl ( ) { not exists ( this .getNameExpr ( _) ) }
@@ -473,6 +497,13 @@ class EmbeddedFieldDecl extends FieldDecl {
473497
474498/**
475499 * A function parameter or result variable declaration.
500+ *
501+ * Examples:
502+ *
503+ * ```go
504+ * name string
505+ * x, y int
506+ * ```
476507 */
477508class ParameterOrResultDecl extends FieldBase , Documentable , ExprParent {
478509 int rawIndex ;
@@ -507,6 +538,13 @@ class ParameterOrResultDecl extends FieldBase, Documentable, ExprParent {
507538
508539/**
509540 * A parameter declaration.
541+ *
542+ * Examples:
543+ *
544+ * ```go
545+ * name string
546+ * x, y int
547+ * ```
510548 */
511549class ParameterDecl extends ParameterOrResultDecl {
512550 ParameterDecl ( ) { rawIndex >= 0 }
@@ -524,6 +562,13 @@ class ParameterDecl extends ParameterOrResultDecl {
524562
525563/**
526564 * A receiver declaration in a function declaration.
565+ *
566+ * Examples:
567+ *
568+ * ```go
569+ * p *Point
570+ * r io.Reader
571+ * ```
527572 */
528573class ReceiverDecl extends FieldBase , Documentable , ExprParent {
529574 FuncDecl fd ;
@@ -547,6 +592,14 @@ class ReceiverDecl extends FieldBase, Documentable, ExprParent {
547592
548593/**
549594 * A result variable declaration.
595+ *
596+ * Examples:
597+ *
598+ * ```go
599+ * error
600+ * r io.Reader
601+ * x, y int
602+ * ```
550603 */
551604class ResultVariableDecl extends ParameterOrResultDecl {
552605 ResultVariableDecl ( ) { rawIndex < 0 }
@@ -564,6 +617,15 @@ class ResultVariableDecl extends ParameterOrResultDecl {
564617
565618/**
566619 * 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+ * ```
567629 */
568630class TypeParamDecl extends @typeparamdecl, Documentable , ExprParent {
569631 TypeParamDecl ( ) { typeparamdecls ( this , _, _) }
@@ -615,6 +677,14 @@ class TypeParamDecl extends @typeparamdecl, Documentable, ExprParent {
615677
616678/**
617679 * 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+ * ```
618688 */
619689class InterfaceMemberSpec extends FieldBase , Documentable , ExprParent {
620690 InterfaceTypeExpr ite ;
@@ -636,6 +706,12 @@ class InterfaceMemberSpec extends FieldBase, Documentable, ExprParent {
636706
637707/**
638708 * A method specification in an interface.
709+ *
710+ * Examples:
711+ *
712+ * ```go
713+ * Read([]byte) (int, error)
714+ * ```
639715 */
640716class MethodSpec extends InterfaceMemberSpec {
641717 Expr name ;
@@ -654,6 +730,13 @@ class MethodSpec extends InterfaceMemberSpec {
654730
655731/**
656732 * An embedding specification in an interface.
733+ *
734+ * Examples:
735+ *
736+ * ```go
737+ * io.Reader
738+ * ~int32 | float32
739+ * ```
657740 */
658741class EmbeddingSpec extends InterfaceMemberSpec {
659742 EmbeddingSpec ( ) { not exists ( this .getChildExpr ( 1 ) ) }
0 commit comments