1  
     2  
     3  
     4  
     5  package pkgbits
     6  
     7  
     8  
     9  
    10  
    11  type Code interface {
    12  	
    13  	Marker() SyncMarker
    14  
    15  	
    16  	Value() int
    17  }
    18  
    19  
    20  type CodeVal int
    21  
    22  func (c CodeVal) Marker() SyncMarker { return SyncVal }
    23  func (c CodeVal) Value() int         { return int(c) }
    24  
    25  
    26  
    27  
    28  const (
    29  	ValBool CodeVal = iota
    30  	ValString
    31  	ValInt64
    32  	ValBigInt
    33  	ValBigRat
    34  	ValBigFloat
    35  )
    36  
    37  
    38  type CodeType int
    39  
    40  func (c CodeType) Marker() SyncMarker { return SyncType }
    41  func (c CodeType) Value() int         { return int(c) }
    42  
    43  
    44  
    45  
    46  const (
    47  	TypeBasic CodeType = iota
    48  	TypeNamed
    49  	TypePointer
    50  	TypeSlice
    51  	TypeArray
    52  	TypeChan
    53  	TypeMap
    54  	TypeSignature
    55  	TypeStruct
    56  	TypeInterface
    57  	TypeUnion
    58  	TypeTypeParam
    59  )
    60  
    61  
    62  type CodeObj int
    63  
    64  func (c CodeObj) Marker() SyncMarker { return SyncCodeObj }
    65  func (c CodeObj) Value() int         { return int(c) }
    66  
    67  
    68  
    69  
    70  const (
    71  	ObjAlias CodeObj = iota
    72  	ObjConst
    73  	ObjType
    74  	ObjFunc
    75  	ObjVar
    76  	ObjStub
    77  )
    78  
View as plain text