.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.1.0 / cmd / gotype / sizesFor18.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.0/cmd/gotype/sizesFor18.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.0/cmd/gotype/sizesFor18.go
new file mode 100644 (file)
index 0000000..94e8176
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !go1.9
+
+// This file contains a copy of the implementation of types.SizesFor
+// since this function is not available in go/types before Go 1.9.
+
+package main
+
+import "go/types"
+
+const defaultCompiler = "gc"
+
+var gcArchSizes = map[string]*types.StdSizes{
+       "386":      {4, 4},
+       "arm":      {4, 4},
+       "arm64":    {8, 8},
+       "amd64":    {8, 8},
+       "amd64p32": {4, 8},
+       "mips":     {4, 4},
+       "mipsle":   {4, 4},
+       "mips64":   {8, 8},
+       "mips64le": {8, 8},
+       "ppc64":    {8, 8},
+       "ppc64le":  {8, 8},
+       "s390x":    {8, 8},
+}
+
+func SizesFor(compiler, arch string) types.Sizes {
+       if compiler != "gc" {
+               return nil
+       }
+       s, ok := gcArchSizes[arch]
+       if !ok {
+               return nil
+       }
+       return s
+}