Skip to content

Commit 938fba2

Browse files
authored
Merge pull request #1320 from Workiva/bumpMaster
[go1.20] update go1.20 with master
2 parents 451b445 + 1a87608 commit 938fba2

File tree

13 files changed

+1204
-716
lines changed

13 files changed

+1204
-716
lines changed

compiler/analysis/info.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,26 @@ func (info *Info) newFuncInfo(n ast.Node) *FuncInfo {
9292
return funcInfo
9393
}
9494

95+
// IsBlocking returns true if the function may contain blocking calls or operations.
9596
func (info *Info) IsBlocking(fun *types.Func) bool {
9697
if funInfo := info.FuncDeclInfos[fun]; funInfo != nil {
9798
return len(funInfo.Blocking) > 0
9899
}
99100
panic(fmt.Errorf(`info did not have function declaration for %s`, fun.FullName()))
100101
}
101102

103+
// VarsWithInitializers returns a set of package-level variables that have
104+
// explicit initializers.
105+
func (info *Info) VarsWithInitializers() map[*types.Var]bool {
106+
result := map[*types.Var]bool{}
107+
for _, init := range info.InitOrder {
108+
for _, o := range init.Lhs {
109+
result[o] = true
110+
}
111+
}
112+
return result
113+
}
114+
102115
func AnalyzePkg(files []*ast.File, fileSet *token.FileSet, typesInfo *types.Info, typesPkg *types.Package, isBlocking func(*types.Func) bool) *Info {
103116
info := &Info{
104117
Info: typesInfo,

compiler/compiler.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"strings"
1818
"time"
1919

20-
"github.com/gopherjs/gopherjs/compiler/internal/symbol"
2120
"github.com/gopherjs/gopherjs/compiler/prelude"
2221
"golang.org/x/tools/go/gcexportdata"
2322
)
@@ -85,56 +84,6 @@ func (a *Archive) RegisterTypes(packages map[string]*types.Package) error {
8584
return err
8685
}
8786

88-
// Decl represents a package-level symbol (e.g. a function, variable or type).
89-
//
90-
// It contains code generated by the compiler for this specific symbol, which is
91-
// grouped by the execution stage it belongs to in the JavaScript runtime.
92-
type Decl struct {
93-
// The package- or receiver-type-qualified name of function or method obj.
94-
// See go/types.Func.FullName().
95-
FullName string
96-
// A logical equivalent of a symbol name in an object file in the traditional
97-
// Go compiler/linker toolchain. Used by GopherJS to support go:linkname
98-
// directives. Must be set for decls that are supported by go:linkname
99-
// implementation.
100-
LinkingName symbol.Name
101-
// A list of package-level JavaScript variable names this symbol needs to declare.
102-
Vars []string
103-
// A JS expression by which the object represented by this decl may be
104-
// referenced within the package context. Empty if the decl represents no such
105-
// object.
106-
RefExpr string
107-
// NamedRecvType is method named recv declare.
108-
NamedRecvType string
109-
// JavaScript code that declares basic information about a symbol. For a type
110-
// it configures basic information about the type and its identity. For a function
111-
// or method it contains its compiled body.
112-
DeclCode []byte
113-
// JavaScript code that initializes reflection metadata about type's method list.
114-
MethodListCode []byte
115-
// JavaScript code that initializes the rest of reflection metadata about a type
116-
// (e.g. struct fields, array type sizes, element types, etc.).
117-
TypeInitCode []byte
118-
// JavaScript code that needs to be executed during the package init phase to
119-
// set the symbol up (e.g. initialize package-level variable value).
120-
InitCode []byte
121-
// Symbol's identifier used by the dead-code elimination logic, not including
122-
// package path. If empty, the symbol is assumed to be alive and will not be
123-
// eliminated. For methods it is the same as its receiver type identifier.
124-
DceObjectFilter string
125-
// The second part of the identified used by dead-code elimination for methods.
126-
// Empty for other types of symbols.
127-
DceMethodFilter string
128-
// List of fully qualified (including package path) DCE symbol identifiers the
129-
// symbol depends on for dead code elimination purposes.
130-
DceDeps []string
131-
// Set to true if a function performs a blocking operation (I/O or
132-
// synchronization). The compiler will have to generate function code such
133-
// that it can be resumed after a blocking operation completes without
134-
// blocking the main thread in the meantime.
135-
Blocking bool
136-
}
137-
13887
type Dependency struct {
13988
Pkg string
14089
Type string

0 commit comments

Comments
 (0)