llgo/ssa: pkg.NewFunc bugfix
This commit is contained in:
@@ -35,11 +35,11 @@ const (
|
||||
loadSyntax = loadTypes | packages.NeedSyntax | packages.NeedTypesInfo
|
||||
)
|
||||
|
||||
func GenFromFile(inFile string) string {
|
||||
func GenFrom(fileOrPkg string) string {
|
||||
cfg := &packages.Config{
|
||||
Mode: loadSyntax,
|
||||
}
|
||||
initial, err := packages.Load(cfg, inFile)
|
||||
initial, err := packages.Load(cfg, fileOrPkg)
|
||||
check(err)
|
||||
|
||||
_, pkgs := ssautil.AllPackages(initial, ssa.SanityCheckFunctions)
|
||||
@@ -61,8 +61,8 @@ func GenFromFile(inFile string) string {
|
||||
return ret.String()
|
||||
}
|
||||
|
||||
func DoFile(inFile, outFile string) {
|
||||
ret := GenFromFile(inFile)
|
||||
func DoFile(fileOrPkg, outFile string) {
|
||||
ret := GenFrom(fileOrPkg)
|
||||
err := os.WriteFile(outFile, []byte(ret), 0644)
|
||||
check(err)
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
package runtime
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright 2009 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.
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type slice struct {
|
||||
array unsafe.Pointer
|
||||
len int
|
||||
cap int
|
||||
}
|
||||
@@ -16,8 +16,16 @@
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Slice is the runtime representation of a slice.
|
||||
type Slice = slice
|
||||
type Slice struct {
|
||||
array unsafe.Pointer
|
||||
len int
|
||||
cap int
|
||||
}
|
||||
|
||||
// NilSlice returns a nil slice.
|
||||
func NilSlice() Slice {
|
||||
|
||||
Reference in New Issue
Block a user