github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/types2/universe.go (about)

     1  // Copyright 2011 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // This file sets up the universe scope and the unsafe package.
     6  
     7  package types2
     8  
     9  // The Universe scope contains all predeclared objects of Go.
    10  // It is the outermost scope of any chain of nested scopes.
    11  var Universe *Scope
    12  
    13  // The Unsafe package is the package returned by an importer
    14  // for the import path "unsafe".
    15  var Unsafe *Package
    16  
    17  // Typ contains the predeclared *Basic types indexed by their
    18  // corresponding BasicKind.
    19  //
    20  // The *Basic type for Typ[Byte] will have the name "uint8".
    21  // Use Universe.Lookup("byte").Type() to obtain the specific
    22  // alias basic type named "byte" (and analogous for "rune").
    23  var Typ = [...]*Basic{
    24  	Invalid: {Invalid, 0, "invalid type"},
    25  
    26  	Bool:          {Bool, IsBoolean, "bool"},
    27  	Int:           {Int, IsInteger, "int"},
    28  	Int8:          {Int8, IsInteger, "int8"},
    29  	Int16:         {Int16, IsInteger, "int16"},
    30  	Int32:         {Int32, IsInteger, "int32"},
    31  	Int64:         {Int64, IsInteger, "int64"},
    32  	Uint:          {Uint, IsInteger | IsUnsigned, "uint"},
    33  	Uint8:         {Uint8, IsInteger | IsUnsigned, "uint8"},
    34  	Uint16:        {Uint16, IsInteger | IsUnsigned, "uint16"},
    35  	Uint32:        {Uint32, IsInteger | IsUnsigned, "uint32"},
    36  	Uint64:        {Uint64, IsInteger | IsUnsigned, "uint64"},
    37  	Uintptr:       {Uintptr, IsInteger | IsUnsigned, "uintptr"},
    38  	Float32:       {Float32, IsFloat, "float32"},
    39  	Float64:       {Float64, IsFloat, "float64"},
    40  	Complex64:     {Complex64, IsComplex, "complex64"},
    41  	Complex128:    {Complex128, IsComplex, "complex128"},
    42  	String:        {String, IsString, "string"},
    43  	UnsafePointer: {UnsafePointer, 0, "Pointer"},
    44  
    45  	UntypedBool:    {UntypedBool, IsBoolean | IsUntyped, "untyped bool"},
    46  	UntypedInt:     {UntypedInt, IsInteger | IsUntyped, "untyped int"},
    47  	UntypedRune:    {UntypedRune, IsInteger | IsUntyped, "untyped rune"},
    48  	UntypedFloat:   {UntypedFloat, IsFloat | IsUntyped, "untyped float"},
    49  	UntypedComplex: {UntypedComplex, IsComplex | IsUntyped, "untyped complex"},
    50  	UntypedString:  {UntypedString, IsString | IsUntyped, "untyped string"},
    51  	UntypedNil:     {UntypedNil, IsUntyped, "untyped nil"},
    52  }
    53  
    54  // DefPredeclaredTestFuncs defines the assert and trace built-ins.
    55  // These built-ins are intended for debugging and testing of this
    56  // package only.
    57  func DefPredeclaredTestFuncs()