github.com/bir3/gocompiler@v0.9.2202/src/go/types/basic.go (about)

     1  // Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.
     2  
     3  // Copyright 2011 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package types
     8  
     9  // BasicKind describes the kind of basic type.
    10  type BasicKind int
    11  
    12  const (
    13  	Invalid BasicKind = iota // type is invalid
    14  
    15  	// predeclared types
    16  	Bool
    17  	Int
    18  	Int8
    19  	Int16
    20  	Int32
    21  	Int64
    22  	Uint
    23  	Uint8
    24  	Uint16
    25  	Uint32
    26  	Uint64
    27  	Uintptr
    28  	Float32
    29  	Float64
    30  	Complex64
    31  	Complex128
    32  	String
    33  	UnsafePointer
    34  
    35  	// types for untyped values
    36  	UntypedBool
    37  	UntypedInt
    38  	UntypedRune
    39  	UntypedFloat
    40  	UntypedComplex
    41  	UntypedString
    42  	UntypedNil
    43  
    44  	// aliases
    45  	Byte = Uint8
    46  	Rune = Int32
    47  )
    48  
    49  // BasicInfo is a set of flags describing properties of a basic type.
    50  type BasicInfo int
    51  
    52  // Properties of basic types.
    53  const (
    54  	IsBoolean BasicInfo = 1 << iota
    55  	IsInteger
    56  	IsUnsigned
    57  	IsFloat
    58  	IsComplex
    59  	IsString
    60  	IsUntyped
    61  
    62  	IsOrdered   = IsInteger | IsFloat | IsString
    63  	IsNumeric   = IsInteger | IsFloat | IsComplex
    64  	IsConstType = IsBoolean | IsNumeric | IsString
    65  )
    66  
    67  // A Basic represents a basic type.
    68  type Basic struct {
    69  	kind BasicKind
    70  	info BasicInfo
    71  	name string
    72  }
    73  
    74  // Kind returns the kind of basic type b.
    75  func (b *Basic) Kind() BasicKind { return b.kind }
    76  
    77  // Info returns information about properties of basic type b.
    78  func (b *Basic) Info() BasicInfo { return b.info }
    79  
    80  // Name returns the name of basic type b.
    81  func (b *Basic) Name() string { return b.name }
    82  
    83  func (b *Basic) Underlying() Type { return b }
    84  func (b *Basic) String() string   { return TypeString(b, nil) }