Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / go / internal / gccgoimporter / backdoor.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/go/internal/gccgoimporter/backdoor.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/go/internal/gccgoimporter/backdoor.go
new file mode 100644 (file)
index 0000000..24580b3
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright 2018 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.
+
+// This file opens a back door to the parser for golang.org/x/tools/go/gccgoexportdata.
+
+package gccgoimporter
+
+import (
+       "go/types"
+       "io"
+)
+
+// Parse reads and parses gccgo export data from in and constructs a
+// Package, inserting it into the imports map.
+func Parse(in io.Reader, imports map[string]*types.Package, path string) (_ *types.Package, err error) {
+       var p parser
+       p.init(path, in, imports)
+       defer func() {
+               switch x := recover().(type) {
+               case nil:
+                       // success
+               case importError:
+                       err = x
+               default:
+                       panic(x) // resume unexpected panic
+               }
+       }()
+       pkg := p.parsePackage()
+       imports[path] = pkg
+       return pkg, err
+}