mirror of
https://github.com/golang/go.git
synced 2026-02-03 17:35:05 +03:00
Compare commits
16 Commits
dev.inline
...
go1.20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de4748c47c | ||
|
|
52bd3b186b | ||
|
|
be7e4fee4b | ||
|
|
b68d699aa7 | ||
|
|
10124c2631 | ||
|
|
5adb0ca8e9 | ||
|
|
8b34676710 | ||
|
|
d7c6da8bac | ||
|
|
9eed826bf9 | ||
|
|
670ce9b8a8 | ||
|
|
b3160e8bce | ||
|
|
9efc2e7f95 | ||
|
|
32593a9192 | ||
|
|
eb598248ba | ||
|
|
9f02342144 | ||
|
|
0480336414 |
@@ -1 +1,2 @@
|
||||
branch: master
|
||||
branch: release-branch.go1.20
|
||||
parent-branch: master
|
||||
|
||||
@@ -1200,9 +1200,8 @@ proxyHandler := &httputil.ReverseProxy{
|
||||
</p>
|
||||
|
||||
<p><!-- CL 444277 -->
|
||||
The <a href="/pkg/time/#Time.MarshalJSON"><code>Time.MarshalJSON</code></a> and
|
||||
<a href="/pkg/time/#Time.UnmarshalJSON"><code>Time.UnmarshalJSON</code></a> methods
|
||||
are now more strict about adherence to RFC 3339.
|
||||
The <a href="/pkg/time/#Time.MarshalJSON"><code>Time.MarshalJSON</code></a> method
|
||||
is now more strict about adherence to RFC 3339.
|
||||
</p>
|
||||
</dd>
|
||||
</dl><!-- time -->
|
||||
|
||||
@@ -180,10 +180,14 @@ func (e *escape) callCommon(ks []hole, call ir.Node, init *ir.Nodes, wrapper *ir
|
||||
argument(e.discardHole(), &call.Args[i])
|
||||
}
|
||||
|
||||
case ir.OLEN, ir.OCAP, ir.OREAL, ir.OIMAG, ir.OCLOSE, ir.OUNSAFESTRINGDATA, ir.OUNSAFESLICEDATA:
|
||||
case ir.OLEN, ir.OCAP, ir.OREAL, ir.OIMAG, ir.OCLOSE:
|
||||
call := call.(*ir.UnaryExpr)
|
||||
argument(e.discardHole(), &call.X)
|
||||
|
||||
case ir.OUNSAFESTRINGDATA, ir.OUNSAFESLICEDATA:
|
||||
call := call.(*ir.UnaryExpr)
|
||||
argument(ks[0], &call.X)
|
||||
|
||||
case ir.OUNSAFEADD, ir.OUNSAFESLICE, ir.OUNSAFESTRING:
|
||||
call := call.(*ir.BinaryExpr)
|
||||
argument(ks[0], &call.X)
|
||||
|
||||
@@ -147,9 +147,10 @@ func NewFunc(pos src.XPos) *Func {
|
||||
|
||||
func (f *Func) isStmt() {}
|
||||
|
||||
func (n *Func) copy() Node { panic(n.no("copy")) }
|
||||
func (n *Func) doChildren(do func(Node) bool) bool { return doNodes(n.Body, do) }
|
||||
func (n *Func) editChildren(edit func(Node) Node) { editNodes(n.Body, edit) }
|
||||
func (n *Func) copy() Node { panic(n.no("copy")) }
|
||||
func (n *Func) doChildren(do func(Node) bool) bool { return doNodes(n.Body, do) }
|
||||
func (n *Func) editChildren(edit func(Node) Node) { editNodes(n.Body, edit) }
|
||||
func (n *Func) editChildrenWithHidden(edit func(Node) Node) { editNodes(n.Body, edit) }
|
||||
|
||||
func (f *Func) Type() *types.Type { return f.Nname.Type() }
|
||||
func (f *Func) Sym() *types.Sym { return f.Nname.Sym() }
|
||||
|
||||
@@ -256,18 +256,24 @@ func processType(t *ast.TypeSpec) {
|
||||
var copyBody strings.Builder
|
||||
var doChildrenBody strings.Builder
|
||||
var editChildrenBody strings.Builder
|
||||
var editChildrenWithHiddenBody strings.Builder
|
||||
for _, f := range fields {
|
||||
names := f.Names
|
||||
ft := f.Type
|
||||
hidden := false
|
||||
if f.Tag != nil {
|
||||
tag := f.Tag.Value[1 : len(f.Tag.Value)-1]
|
||||
if strings.HasPrefix(tag, "mknode:") {
|
||||
if tag[7:] == "\"-\"" {
|
||||
continue
|
||||
if !isNamedType(ft, "Node") {
|
||||
continue
|
||||
}
|
||||
hidden = true
|
||||
} else {
|
||||
panic(fmt.Sprintf("unexpected tag value: %s", tag))
|
||||
}
|
||||
panic(fmt.Sprintf("unexpected tag value: %s", tag))
|
||||
}
|
||||
}
|
||||
names := f.Names
|
||||
ft := f.Type
|
||||
if isNamedType(ft, "Nodes") {
|
||||
// Nodes == []Node
|
||||
ft = &ast.ArrayType{Elt: &ast.Ident{Name: "Node"}}
|
||||
@@ -286,6 +292,20 @@ func processType(t *ast.TypeSpec) {
|
||||
continue
|
||||
}
|
||||
for _, name := range names {
|
||||
ptr := ""
|
||||
if isPtr {
|
||||
ptr = "*"
|
||||
}
|
||||
if isSlice {
|
||||
fmt.Fprintf(&editChildrenWithHiddenBody,
|
||||
"edit%ss(n.%s, edit)\n", ft, name)
|
||||
} else {
|
||||
fmt.Fprintf(&editChildrenWithHiddenBody,
|
||||
"if n.%s != nil {\nn.%s = edit(n.%s).(%s%s)\n}\n", name, name, name, ptr, ft)
|
||||
}
|
||||
if hidden {
|
||||
continue
|
||||
}
|
||||
if isSlice {
|
||||
fmt.Fprintf(©Body, "c.%s = copy%ss(c.%s)\n", name, ft, name)
|
||||
fmt.Fprintf(&doChildrenBody,
|
||||
@@ -295,10 +315,6 @@ func processType(t *ast.TypeSpec) {
|
||||
} else {
|
||||
fmt.Fprintf(&doChildrenBody,
|
||||
"if n.%s != nil && do(n.%s) {\nreturn true\n}\n", name, name)
|
||||
ptr := ""
|
||||
if isPtr {
|
||||
ptr = "*"
|
||||
}
|
||||
fmt.Fprintf(&editChildrenBody,
|
||||
"if n.%s != nil {\nn.%s = edit(n.%s).(%s%s)\n}\n", name, name, name, ptr, ft)
|
||||
}
|
||||
@@ -313,6 +329,9 @@ func processType(t *ast.TypeSpec) {
|
||||
fmt.Fprintf(&buf, "func (n *%s) editChildren(edit func(Node) Node) {\n", name)
|
||||
buf.WriteString(editChildrenBody.String())
|
||||
fmt.Fprintf(&buf, "}\n")
|
||||
fmt.Fprintf(&buf, "func (n *%s) editChildrenWithHidden(edit func(Node) Node) {\n", name)
|
||||
buf.WriteString(editChildrenWithHiddenBody.String())
|
||||
fmt.Fprintf(&buf, "}\n")
|
||||
}
|
||||
|
||||
func generateHelpers() {
|
||||
|
||||
@@ -134,9 +134,10 @@ type Name struct {
|
||||
|
||||
func (n *Name) isExpr() {}
|
||||
|
||||
func (n *Name) copy() Node { panic(n.no("copy")) }
|
||||
func (n *Name) doChildren(do func(Node) bool) bool { return false }
|
||||
func (n *Name) editChildren(edit func(Node) Node) {}
|
||||
func (n *Name) copy() Node { panic(n.no("copy")) }
|
||||
func (n *Name) doChildren(do func(Node) bool) bool { return false }
|
||||
func (n *Name) editChildren(edit func(Node) Node) {}
|
||||
func (n *Name) editChildrenWithHidden(edit func(Node) Node) {}
|
||||
|
||||
// RecordFrameOffset records the frame offset for the name.
|
||||
// It is used by package types when laying out function arguments.
|
||||
|
||||
@@ -30,6 +30,7 @@ type Node interface {
|
||||
|
||||
doChildren(func(Node) bool) bool
|
||||
editChildren(func(Node) Node)
|
||||
editChildrenWithHidden(func(Node) Node)
|
||||
|
||||
// Abstract graph structure, for generic traversals.
|
||||
Op() Op
|
||||
|
||||
@@ -30,6 +30,13 @@ func (n *AddStringExpr) editChildren(edit func(Node) Node) {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
func (n *AddStringExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editNodes(n.List, edit)
|
||||
if n.Prealloc != nil {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *AddrExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *AddrExpr) copy() Node {
|
||||
@@ -58,6 +65,15 @@ func (n *AddrExpr) editChildren(edit func(Node) Node) {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
func (n *AddrExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.Prealloc != nil {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *AssignListStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *AssignListStmt) copy() Node {
|
||||
@@ -84,6 +100,11 @@ func (n *AssignListStmt) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.Lhs, edit)
|
||||
editNodes(n.Rhs, edit)
|
||||
}
|
||||
func (n *AssignListStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editNodes(n.Lhs, edit)
|
||||
editNodes(n.Rhs, edit)
|
||||
}
|
||||
|
||||
func (n *AssignOpStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *AssignOpStmt) copy() Node {
|
||||
@@ -112,6 +133,15 @@ func (n *AssignOpStmt) editChildren(edit func(Node) Node) {
|
||||
n.Y = edit(n.Y).(Node)
|
||||
}
|
||||
}
|
||||
func (n *AssignOpStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.Y != nil {
|
||||
n.Y = edit(n.Y).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *AssignStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *AssignStmt) copy() Node {
|
||||
@@ -140,6 +170,15 @@ func (n *AssignStmt) editChildren(edit func(Node) Node) {
|
||||
n.Y = edit(n.Y).(Node)
|
||||
}
|
||||
}
|
||||
func (n *AssignStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.Y != nil {
|
||||
n.Y = edit(n.Y).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *BasicLit) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *BasicLit) copy() Node {
|
||||
@@ -156,6 +195,9 @@ func (n *BasicLit) doChildren(do func(Node) bool) bool {
|
||||
func (n *BasicLit) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *BasicLit) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *BinaryExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *BinaryExpr) copy() Node {
|
||||
@@ -184,6 +226,18 @@ func (n *BinaryExpr) editChildren(edit func(Node) Node) {
|
||||
n.Y = edit(n.Y).(Node)
|
||||
}
|
||||
}
|
||||
func (n *BinaryExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.Y != nil {
|
||||
n.Y = edit(n.Y).(Node)
|
||||
}
|
||||
if n.RType != nil {
|
||||
n.RType = edit(n.RType).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *BlockStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *BlockStmt) copy() Node {
|
||||
@@ -205,6 +259,10 @@ func (n *BlockStmt) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editNodes(n.List, edit)
|
||||
}
|
||||
func (n *BlockStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editNodes(n.List, edit)
|
||||
}
|
||||
|
||||
func (n *BranchStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *BranchStmt) copy() Node {
|
||||
@@ -221,6 +279,9 @@ func (n *BranchStmt) doChildren(do func(Node) bool) bool {
|
||||
func (n *BranchStmt) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *BranchStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *CallExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *CallExpr) copy() Node {
|
||||
@@ -253,6 +314,17 @@ func (n *CallExpr) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.Args, edit)
|
||||
editNames(n.KeepAlive, edit)
|
||||
}
|
||||
func (n *CallExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
editNodes(n.Args, edit)
|
||||
if n.RType != nil {
|
||||
n.RType = edit(n.RType).(Node)
|
||||
}
|
||||
editNames(n.KeepAlive, edit)
|
||||
}
|
||||
|
||||
func (n *CaseClause) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *CaseClause) copy() Node {
|
||||
@@ -290,6 +362,15 @@ func (n *CaseClause) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.RTypes, edit)
|
||||
editNodes(n.Body, edit)
|
||||
}
|
||||
func (n *CaseClause) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Var != nil {
|
||||
n.Var = edit(n.Var).(*Name)
|
||||
}
|
||||
editNodes(n.List, edit)
|
||||
editNodes(n.RTypes, edit)
|
||||
editNodes(n.Body, edit)
|
||||
}
|
||||
|
||||
func (n *ClosureExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *ClosureExpr) copy() Node {
|
||||
@@ -312,6 +393,12 @@ func (n *ClosureExpr) editChildren(edit func(Node) Node) {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
func (n *ClosureExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Prealloc != nil {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *CommClause) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *CommClause) copy() Node {
|
||||
@@ -339,6 +426,13 @@ func (n *CommClause) editChildren(edit func(Node) Node) {
|
||||
}
|
||||
editNodes(n.Body, edit)
|
||||
}
|
||||
func (n *CommClause) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Comm != nil {
|
||||
n.Comm = edit(n.Comm).(Node)
|
||||
}
|
||||
editNodes(n.Body, edit)
|
||||
}
|
||||
|
||||
func (n *CompLitExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *CompLitExpr) copy() Node {
|
||||
@@ -366,6 +460,16 @@ func (n *CompLitExpr) editChildren(edit func(Node) Node) {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
func (n *CompLitExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editNodes(n.List, edit)
|
||||
if n.RType != nil {
|
||||
n.RType = edit(n.RType).(Node)
|
||||
}
|
||||
if n.Prealloc != nil {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *ConstExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *ConstExpr) copy() Node {
|
||||
@@ -382,6 +486,9 @@ func (n *ConstExpr) doChildren(do func(Node) bool) bool {
|
||||
func (n *ConstExpr) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *ConstExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *ConvExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *ConvExpr) copy() Node {
|
||||
@@ -404,6 +511,24 @@ func (n *ConvExpr) editChildren(edit func(Node) Node) {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
func (n *ConvExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.TypeWord != nil {
|
||||
n.TypeWord = edit(n.TypeWord).(Node)
|
||||
}
|
||||
if n.SrcRType != nil {
|
||||
n.SrcRType = edit(n.SrcRType).(Node)
|
||||
}
|
||||
if n.ElemRType != nil {
|
||||
n.ElemRType = edit(n.ElemRType).(Node)
|
||||
}
|
||||
if n.ElemElemRType != nil {
|
||||
n.ElemElemRType = edit(n.ElemElemRType).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *Decl) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *Decl) copy() Node {
|
||||
@@ -421,6 +546,11 @@ func (n *Decl) editChildren(edit func(Node) Node) {
|
||||
n.X = edit(n.X).(*Name)
|
||||
}
|
||||
}
|
||||
func (n *Decl) editChildrenWithHidden(edit func(Node) Node) {
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(*Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *DynamicType) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *DynamicType) copy() Node {
|
||||
@@ -449,6 +579,15 @@ func (n *DynamicType) editChildren(edit func(Node) Node) {
|
||||
n.ITab = edit(n.ITab).(Node)
|
||||
}
|
||||
}
|
||||
func (n *DynamicType) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.RType != nil {
|
||||
n.RType = edit(n.RType).(Node)
|
||||
}
|
||||
if n.ITab != nil {
|
||||
n.ITab = edit(n.ITab).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *DynamicTypeAssertExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *DynamicTypeAssertExpr) copy() Node {
|
||||
@@ -489,6 +628,21 @@ func (n *DynamicTypeAssertExpr) editChildren(edit func(Node) Node) {
|
||||
n.ITab = edit(n.ITab).(Node)
|
||||
}
|
||||
}
|
||||
func (n *DynamicTypeAssertExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.SrcRType != nil {
|
||||
n.SrcRType = edit(n.SrcRType).(Node)
|
||||
}
|
||||
if n.RType != nil {
|
||||
n.RType = edit(n.RType).(Node)
|
||||
}
|
||||
if n.ITab != nil {
|
||||
n.ITab = edit(n.ITab).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *ForStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *ForStmt) copy() Node {
|
||||
@@ -522,6 +676,16 @@ func (n *ForStmt) editChildren(edit func(Node) Node) {
|
||||
}
|
||||
editNodes(n.Body, edit)
|
||||
}
|
||||
func (n *ForStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Cond != nil {
|
||||
n.Cond = edit(n.Cond).(Node)
|
||||
}
|
||||
if n.Post != nil {
|
||||
n.Post = edit(n.Post).(Node)
|
||||
}
|
||||
editNodes(n.Body, edit)
|
||||
}
|
||||
|
||||
func (n *Func) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
|
||||
@@ -546,6 +710,12 @@ func (n *GoDeferStmt) editChildren(edit func(Node) Node) {
|
||||
n.Call = edit(n.Call).(Node)
|
||||
}
|
||||
}
|
||||
func (n *GoDeferStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Call != nil {
|
||||
n.Call = edit(n.Call).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *Ident) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *Ident) copy() Node {
|
||||
@@ -562,6 +732,9 @@ func (n *Ident) doChildren(do func(Node) bool) bool {
|
||||
func (n *Ident) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *Ident) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *IfStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *IfStmt) copy() Node {
|
||||
@@ -594,6 +767,14 @@ func (n *IfStmt) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.Body, edit)
|
||||
editNodes(n.Else, edit)
|
||||
}
|
||||
func (n *IfStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Cond != nil {
|
||||
n.Cond = edit(n.Cond).(Node)
|
||||
}
|
||||
editNodes(n.Body, edit)
|
||||
editNodes(n.Else, edit)
|
||||
}
|
||||
|
||||
func (n *IndexExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *IndexExpr) copy() Node {
|
||||
@@ -622,6 +803,18 @@ func (n *IndexExpr) editChildren(edit func(Node) Node) {
|
||||
n.Index = edit(n.Index).(Node)
|
||||
}
|
||||
}
|
||||
func (n *IndexExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.Index != nil {
|
||||
n.Index = edit(n.Index).(Node)
|
||||
}
|
||||
if n.RType != nil {
|
||||
n.RType = edit(n.RType).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *InlineMarkStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *InlineMarkStmt) copy() Node {
|
||||
@@ -638,6 +831,9 @@ func (n *InlineMarkStmt) doChildren(do func(Node) bool) bool {
|
||||
func (n *InlineMarkStmt) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *InlineMarkStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *InlinedCallExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *InlinedCallExpr) copy() Node {
|
||||
@@ -664,6 +860,11 @@ func (n *InlinedCallExpr) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.Body, edit)
|
||||
editNodes(n.ReturnVars, edit)
|
||||
}
|
||||
func (n *InlinedCallExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editNodes(n.Body, edit)
|
||||
editNodes(n.ReturnVars, edit)
|
||||
}
|
||||
|
||||
func (n *InstExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *InstExpr) copy() Node {
|
||||
@@ -691,6 +892,13 @@ func (n *InstExpr) editChildren(edit func(Node) Node) {
|
||||
}
|
||||
editNtypes(n.Targs, edit)
|
||||
}
|
||||
func (n *InstExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
editNtypes(n.Targs, edit)
|
||||
}
|
||||
|
||||
func (n *JumpTableStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *JumpTableStmt) copy() Node {
|
||||
@@ -713,6 +921,12 @@ func (n *JumpTableStmt) editChildren(edit func(Node) Node) {
|
||||
n.Idx = edit(n.Idx).(Node)
|
||||
}
|
||||
}
|
||||
func (n *JumpTableStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Idx != nil {
|
||||
n.Idx = edit(n.Idx).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *KeyExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *KeyExpr) copy() Node {
|
||||
@@ -741,6 +955,15 @@ func (n *KeyExpr) editChildren(edit func(Node) Node) {
|
||||
n.Value = edit(n.Value).(Node)
|
||||
}
|
||||
}
|
||||
func (n *KeyExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Key != nil {
|
||||
n.Key = edit(n.Key).(Node)
|
||||
}
|
||||
if n.Value != nil {
|
||||
n.Value = edit(n.Value).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *LabelStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *LabelStmt) copy() Node {
|
||||
@@ -757,6 +980,9 @@ func (n *LabelStmt) doChildren(do func(Node) bool) bool {
|
||||
func (n *LabelStmt) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *LabelStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *LinksymOffsetExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *LinksymOffsetExpr) copy() Node {
|
||||
@@ -773,6 +999,9 @@ func (n *LinksymOffsetExpr) doChildren(do func(Node) bool) bool {
|
||||
func (n *LinksymOffsetExpr) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *LinksymOffsetExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *LogicalExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *LogicalExpr) copy() Node {
|
||||
@@ -801,6 +1030,15 @@ func (n *LogicalExpr) editChildren(edit func(Node) Node) {
|
||||
n.Y = edit(n.Y).(Node)
|
||||
}
|
||||
}
|
||||
func (n *LogicalExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.Y != nil {
|
||||
n.Y = edit(n.Y).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *MakeExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *MakeExpr) copy() Node {
|
||||
@@ -829,6 +1067,18 @@ func (n *MakeExpr) editChildren(edit func(Node) Node) {
|
||||
n.Cap = edit(n.Cap).(Node)
|
||||
}
|
||||
}
|
||||
func (n *MakeExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.RType != nil {
|
||||
n.RType = edit(n.RType).(Node)
|
||||
}
|
||||
if n.Len != nil {
|
||||
n.Len = edit(n.Len).(Node)
|
||||
}
|
||||
if n.Cap != nil {
|
||||
n.Cap = edit(n.Cap).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *Name) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
|
||||
@@ -847,6 +1097,9 @@ func (n *NilExpr) doChildren(do func(Node) bool) bool {
|
||||
func (n *NilExpr) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *NilExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *ParenExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *ParenExpr) copy() Node {
|
||||
@@ -869,6 +1122,12 @@ func (n *ParenExpr) editChildren(edit func(Node) Node) {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
func (n *ParenExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *RangeStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *RangeStmt) copy() Node {
|
||||
@@ -914,6 +1173,37 @@ func (n *RangeStmt) editChildren(edit func(Node) Node) {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
func (n *RangeStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.RType != nil {
|
||||
n.RType = edit(n.RType).(Node)
|
||||
}
|
||||
if n.Key != nil {
|
||||
n.Key = edit(n.Key).(Node)
|
||||
}
|
||||
if n.Value != nil {
|
||||
n.Value = edit(n.Value).(Node)
|
||||
}
|
||||
editNodes(n.Body, edit)
|
||||
if n.Prealloc != nil {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
if n.KeyTypeWord != nil {
|
||||
n.KeyTypeWord = edit(n.KeyTypeWord).(Node)
|
||||
}
|
||||
if n.KeySrcRType != nil {
|
||||
n.KeySrcRType = edit(n.KeySrcRType).(Node)
|
||||
}
|
||||
if n.ValueTypeWord != nil {
|
||||
n.ValueTypeWord = edit(n.ValueTypeWord).(Node)
|
||||
}
|
||||
if n.ValueSrcRType != nil {
|
||||
n.ValueSrcRType = edit(n.ValueSrcRType).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *RawOrigExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *RawOrigExpr) copy() Node {
|
||||
@@ -930,6 +1220,9 @@ func (n *RawOrigExpr) doChildren(do func(Node) bool) bool {
|
||||
func (n *RawOrigExpr) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *RawOrigExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *ResultExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *ResultExpr) copy() Node {
|
||||
@@ -946,6 +1239,9 @@ func (n *ResultExpr) doChildren(do func(Node) bool) bool {
|
||||
func (n *ResultExpr) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
func (n *ResultExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
}
|
||||
|
||||
func (n *ReturnStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *ReturnStmt) copy() Node {
|
||||
@@ -967,6 +1263,10 @@ func (n *ReturnStmt) editChildren(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editNodes(n.Results, edit)
|
||||
}
|
||||
func (n *ReturnStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editNodes(n.Results, edit)
|
||||
}
|
||||
|
||||
func (n *SelectStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *SelectStmt) copy() Node {
|
||||
@@ -993,6 +1293,11 @@ func (n *SelectStmt) editChildren(edit func(Node) Node) {
|
||||
editCommClauses(n.Cases, edit)
|
||||
editNodes(n.Compiled, edit)
|
||||
}
|
||||
func (n *SelectStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
editCommClauses(n.Cases, edit)
|
||||
editNodes(n.Compiled, edit)
|
||||
}
|
||||
|
||||
func (n *SelectorExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *SelectorExpr) copy() Node {
|
||||
@@ -1021,6 +1326,15 @@ func (n *SelectorExpr) editChildren(edit func(Node) Node) {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
func (n *SelectorExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.Prealloc != nil {
|
||||
n.Prealloc = edit(n.Prealloc).(*Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *SendStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *SendStmt) copy() Node {
|
||||
@@ -1049,6 +1363,15 @@ func (n *SendStmt) editChildren(edit func(Node) Node) {
|
||||
n.Value = edit(n.Value).(Node)
|
||||
}
|
||||
}
|
||||
func (n *SendStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Chan != nil {
|
||||
n.Chan = edit(n.Chan).(Node)
|
||||
}
|
||||
if n.Value != nil {
|
||||
n.Value = edit(n.Value).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *SliceExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *SliceExpr) copy() Node {
|
||||
@@ -1089,6 +1412,21 @@ func (n *SliceExpr) editChildren(edit func(Node) Node) {
|
||||
n.Max = edit(n.Max).(Node)
|
||||
}
|
||||
}
|
||||
func (n *SliceExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.Low != nil {
|
||||
n.Low = edit(n.Low).(Node)
|
||||
}
|
||||
if n.High != nil {
|
||||
n.High = edit(n.High).(Node)
|
||||
}
|
||||
if n.Max != nil {
|
||||
n.Max = edit(n.Max).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *SliceHeaderExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *SliceHeaderExpr) copy() Node {
|
||||
@@ -1123,6 +1461,18 @@ func (n *SliceHeaderExpr) editChildren(edit func(Node) Node) {
|
||||
n.Cap = edit(n.Cap).(Node)
|
||||
}
|
||||
}
|
||||
func (n *SliceHeaderExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Ptr != nil {
|
||||
n.Ptr = edit(n.Ptr).(Node)
|
||||
}
|
||||
if n.Len != nil {
|
||||
n.Len = edit(n.Len).(Node)
|
||||
}
|
||||
if n.Cap != nil {
|
||||
n.Cap = edit(n.Cap).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *StarExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *StarExpr) copy() Node {
|
||||
@@ -1145,6 +1495,12 @@ func (n *StarExpr) editChildren(edit func(Node) Node) {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
func (n *StarExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *StringHeaderExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *StringHeaderExpr) copy() Node {
|
||||
@@ -1173,6 +1529,15 @@ func (n *StringHeaderExpr) editChildren(edit func(Node) Node) {
|
||||
n.Len = edit(n.Len).(Node)
|
||||
}
|
||||
}
|
||||
func (n *StringHeaderExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Ptr != nil {
|
||||
n.Ptr = edit(n.Ptr).(Node)
|
||||
}
|
||||
if n.Len != nil {
|
||||
n.Len = edit(n.Len).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *StructKeyExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *StructKeyExpr) copy() Node {
|
||||
@@ -1195,6 +1560,12 @@ func (n *StructKeyExpr) editChildren(edit func(Node) Node) {
|
||||
n.Value = edit(n.Value).(Node)
|
||||
}
|
||||
}
|
||||
func (n *StructKeyExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Value != nil {
|
||||
n.Value = edit(n.Value).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *SwitchStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *SwitchStmt) copy() Node {
|
||||
@@ -1227,6 +1598,14 @@ func (n *SwitchStmt) editChildren(edit func(Node) Node) {
|
||||
editCaseClauses(n.Cases, edit)
|
||||
editNodes(n.Compiled, edit)
|
||||
}
|
||||
func (n *SwitchStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Tag != nil {
|
||||
n.Tag = edit(n.Tag).(Node)
|
||||
}
|
||||
editCaseClauses(n.Cases, edit)
|
||||
editNodes(n.Compiled, edit)
|
||||
}
|
||||
|
||||
func (n *TailCallStmt) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *TailCallStmt) copy() Node {
|
||||
@@ -1249,6 +1628,12 @@ func (n *TailCallStmt) editChildren(edit func(Node) Node) {
|
||||
n.Call = edit(n.Call).(*CallExpr)
|
||||
}
|
||||
}
|
||||
func (n *TailCallStmt) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.Call != nil {
|
||||
n.Call = edit(n.Call).(*CallExpr)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *TypeAssertExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *TypeAssertExpr) copy() Node {
|
||||
@@ -1271,6 +1656,15 @@ func (n *TypeAssertExpr) editChildren(edit func(Node) Node) {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
func (n *TypeAssertExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
if n.ITab != nil {
|
||||
n.ITab = edit(n.ITab).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *TypeSwitchGuard) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *TypeSwitchGuard) copy() Node {
|
||||
@@ -1294,6 +1688,14 @@ func (n *TypeSwitchGuard) editChildren(edit func(Node) Node) {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
func (n *TypeSwitchGuard) editChildrenWithHidden(edit func(Node) Node) {
|
||||
if n.Tag != nil {
|
||||
n.Tag = edit(n.Tag).(*Ident)
|
||||
}
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *UnaryExpr) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *UnaryExpr) copy() Node {
|
||||
@@ -1316,6 +1718,12 @@ func (n *UnaryExpr) editChildren(edit func(Node) Node) {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
func (n *UnaryExpr) editChildrenWithHidden(edit func(Node) Node) {
|
||||
editNodes(n.init, edit)
|
||||
if n.X != nil {
|
||||
n.X = edit(n.X).(Node)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *typeNode) Format(s fmt.State, verb rune) { fmtNode(n, s, verb) }
|
||||
func (n *typeNode) copy() Node {
|
||||
@@ -1327,6 +1735,8 @@ func (n *typeNode) doChildren(do func(Node) bool) bool {
|
||||
}
|
||||
func (n *typeNode) editChildren(edit func(Node) Node) {
|
||||
}
|
||||
func (n *typeNode) editChildrenWithHidden(edit func(Node) Node) {
|
||||
}
|
||||
|
||||
func copyCaseClauses(list []*CaseClause) []*CaseClause {
|
||||
if list == nil {
|
||||
|
||||
@@ -184,3 +184,15 @@ func EditChildren(n Node, edit func(Node) Node) {
|
||||
}
|
||||
n.editChildren(edit)
|
||||
}
|
||||
|
||||
// EditChildrenWithHidden is like EditChildren, but also edits
|
||||
// Node-typed fields tagged with `mknode:"-"`.
|
||||
//
|
||||
// TODO(mdempsky): Remove the `mknode:"-"` tags so this function can
|
||||
// go away.
|
||||
func EditChildrenWithHidden(n Node, edit func(Node) Node) {
|
||||
if n == nil {
|
||||
return
|
||||
}
|
||||
n.editChildrenWithHidden(edit)
|
||||
}
|
||||
|
||||
@@ -856,9 +856,6 @@ func prove(f *Func) {
|
||||
case OpAnd64, OpAnd32, OpAnd16, OpAnd8:
|
||||
ft.update(b, v, v.Args[1], unsigned, lt|eq)
|
||||
ft.update(b, v, v.Args[0], unsigned, lt|eq)
|
||||
case OpOr64, OpOr32, OpOr16, OpOr8:
|
||||
ft.update(b, v, v.Args[1], unsigned, gt|eq)
|
||||
ft.update(b, v, v.Args[0], unsigned, gt|eq)
|
||||
case OpPhi:
|
||||
// Determine the min and max value of OpPhi composed entirely of integer constants.
|
||||
//
|
||||
|
||||
@@ -838,7 +838,7 @@ func subst(n ir.Node, m map[*ir.Name]ir.Node) (ir.Node, bool) {
|
||||
return x
|
||||
}
|
||||
x = ir.Copy(x)
|
||||
ir.EditChildren(x, edit)
|
||||
ir.EditChildrenWithHidden(x, edit)
|
||||
if x, ok := x.(*ir.ConvExpr); ok && x.X.Op() == ir.OLITERAL {
|
||||
// A conversion of variable or expression involving variables
|
||||
// may become a conversion of constant after inlining the parameters
|
||||
|
||||
@@ -288,6 +288,7 @@ func (d *dstate) VisitFunc(pkgIdx uint32, fnIdx uint32, fd *coverage.FuncDesc) {
|
||||
}
|
||||
fmt.Printf("\nFunc: %s\n", fd.Funcname)
|
||||
fmt.Printf("Srcfile: %s\n", fd.Srcfile)
|
||||
fmt.Printf("Literal: %v\n", fd.Lit)
|
||||
}
|
||||
for i := 0; i < len(fd.Units); i++ {
|
||||
u := fd.Units[i]
|
||||
|
||||
@@ -9,7 +9,7 @@ require (
|
||||
golang.org/x/sync v0.1.0
|
||||
golang.org/x/sys v0.3.0
|
||||
golang.org/x/term v0.2.0
|
||||
golang.org/x/tools v0.3.1-0.20221121233702-060c049c4674
|
||||
golang.org/x/tools v0.3.1-0.20230118190848-070db2996ebe
|
||||
)
|
||||
|
||||
require github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2 // indirect
|
||||
|
||||
@@ -12,5 +12,5 @@ golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
golang.org/x/tools v0.3.1-0.20221121233702-060c049c4674 h1:Lv0Y+JVwLQF2YThz8ImE7rP2FSv/IzV9lS2k7bvua6U=
|
||||
golang.org/x/tools v0.3.1-0.20221121233702-060c049c4674/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
|
||||
golang.org/x/tools v0.3.1-0.20230118190848-070db2996ebe h1:1B2tjdkEp2f885xTfSsY+7mi5fNZHRxWciDl8Hz3EXg=
|
||||
golang.org/x/tools v0.3.1-0.20230118190848-070db2996ebe/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
|
||||
|
||||
5
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go
generated
vendored
5
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go
generated
vendored
@@ -303,6 +303,11 @@ func parallelSubtest(info *types.Info, call *ast.CallExpr) []ast.Stmt {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(call.Args) != 2 {
|
||||
// Ignore calls such as t.Run(fn()).
|
||||
return nil
|
||||
}
|
||||
|
||||
lit, _ := call.Args[1].(*ast.FuncLit)
|
||||
if lit == nil {
|
||||
return nil
|
||||
|
||||
2
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
generated
vendored
2
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
generated
vendored
@@ -910,7 +910,7 @@ func okPrintfArg(pass *analysis.Pass, call *ast.CallExpr, state *formatState) (o
|
||||
if reason != "" {
|
||||
details = " (" + reason + ")"
|
||||
}
|
||||
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s, see also https://pkg.go.dev/fmt#hdr-Printing", state.name, state.format, analysisutil.Format(pass.Fset, arg), typeString, details)
|
||||
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s", state.name, state.format, analysisutil.Format(pass.Fset, arg), typeString, details)
|
||||
return false
|
||||
}
|
||||
if v.typ&argString != 0 && v.verb != 'T' && !bytes.Contains(state.flags, []byte{'#'}) {
|
||||
|
||||
2
src/cmd/vendor/modules.txt
vendored
2
src/cmd/vendor/modules.txt
vendored
@@ -46,7 +46,7 @@ golang.org/x/sys/windows
|
||||
# golang.org/x/term v0.2.0
|
||||
## explicit; go 1.17
|
||||
golang.org/x/term
|
||||
# golang.org/x/tools v0.3.1-0.20221121233702-060c049c4674
|
||||
# golang.org/x/tools v0.3.1-0.20230118190848-070db2996ebe
|
||||
## explicit; go 1.18
|
||||
golang.org/x/tools/cover
|
||||
golang.org/x/tools/go/analysis
|
||||
|
||||
@@ -123,8 +123,6 @@ func (d *CoverageMetaDataDecoder) ReadFunc(fidx uint32, f *coverage.FuncDesc) er
|
||||
})
|
||||
}
|
||||
lit := d.r.ReadULEB128()
|
||||
if lit != 0 {
|
||||
f.Lit = true
|
||||
}
|
||||
f.Lit = lit != 0
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -274,3 +274,58 @@ func TestMetaDataWriterReader(t *testing.T) {
|
||||
inf.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func TestMetaDataDecodeLitFlagIssue57942(t *testing.T) {
|
||||
|
||||
// Encode a package with a few functions. The funcs alternate
|
||||
// between regular functions and function literals.
|
||||
pp := "foo/bar/pkg"
|
||||
pn := "pkg"
|
||||
mp := "barmod"
|
||||
b, err := encodemeta.NewCoverageMetaDataBuilder(pp, pn, mp)
|
||||
if err != nil {
|
||||
t.Fatalf("making builder: %v", err)
|
||||
}
|
||||
const NF = 6
|
||||
const NCU = 1
|
||||
ln := uint32(10)
|
||||
wantfds := []coverage.FuncDesc{}
|
||||
for fi := uint32(0); fi < NF; fi++ {
|
||||
fis := fmt.Sprintf("%d", fi)
|
||||
fd := coverage.FuncDesc{
|
||||
Funcname: "func" + fis,
|
||||
Srcfile: "foo" + fis + ".go",
|
||||
Units: []coverage.CoverableUnit{
|
||||
coverage.CoverableUnit{StLine: ln + 1, StCol: 2, EnLine: ln + 3, EnCol: 4, NxStmts: fi + 2},
|
||||
},
|
||||
Lit: (fi % 2) == 0,
|
||||
}
|
||||
wantfds = append(wantfds, fd)
|
||||
b.AddFunc(fd)
|
||||
}
|
||||
|
||||
// Emit into a writer.
|
||||
drws := &slicewriter.WriteSeeker{}
|
||||
b.Emit(drws)
|
||||
|
||||
// Decode the result.
|
||||
drws.Seek(0, io.SeekStart)
|
||||
dec, err := decodemeta.NewCoverageMetaDataDecoder(drws.BytesWritten(), false)
|
||||
if err != nil {
|
||||
t.Fatalf("making decoder: %v", err)
|
||||
}
|
||||
nf := dec.NumFuncs()
|
||||
if nf != NF {
|
||||
t.Fatalf("decoder number of functions: got %d want %d", nf, NF)
|
||||
}
|
||||
var fn coverage.FuncDesc
|
||||
for i := uint32(0); i < uint32(NF); i++ {
|
||||
if err := dec.ReadFunc(i, &fn); err != nil {
|
||||
t.Fatalf("err reading function %d: %v", i, err)
|
||||
}
|
||||
res := cmpFuncDesc(wantfds[i], fn)
|
||||
if res != "" {
|
||||
t.Errorf("ReadFunc(%d): %s", i, res)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"internal/coverage/pods"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// processCoverTestDir is called (via a linknamed reference) from
|
||||
@@ -80,7 +81,15 @@ func processCoverTestDirInternal(dir string, cfile string, cm string, cpkg strin
|
||||
cf: cformat.NewFormatter(cmode),
|
||||
cmode: cmode,
|
||||
}
|
||||
// Generate the expected hash string based on the final meta-data
|
||||
// hash for this test, then look only for pods that refer to that
|
||||
// hash (just in case there are multiple instrumented executables
|
||||
// in play). See issue #57924 for more on this.
|
||||
hashstring := fmt.Sprintf("%x", finalHash)
|
||||
for _, p := range podlist {
|
||||
if !strings.Contains(p.MetaFile, hashstring) {
|
||||
continue
|
||||
}
|
||||
if err := ts.processPod(p); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -27,9 +27,11 @@ import (
|
||||
// In the terminology of the Go memory model, Map arranges that a write operation
|
||||
// “synchronizes before” any read operation that observes the effect of the write, where
|
||||
// read and write operations are defined as follows.
|
||||
// Load, LoadAndDelete, LoadOrStore are read operations;
|
||||
// Delete, LoadAndDelete, and Store are write operations;
|
||||
// and LoadOrStore is a write operation when it returns loaded set to false.
|
||||
// Load, LoadAndDelete, LoadOrStore, Swap, CompareAndSwap, and CompareAndDelete
|
||||
// are read operations; Delete, LoadAndDelete, Store, and Swap are write operations;
|
||||
// LoadOrStore is a write operation when it returns loaded set to false;
|
||||
// CompareAndSwap is a write operation when it returns swapped set to true;
|
||||
// and CompareAndDelete is a write operation when it returns deleted set to true.
|
||||
type Map struct {
|
||||
mu Mutex
|
||||
|
||||
|
||||
@@ -155,7 +155,8 @@ func parseRFC3339[bytes []byte | string](s bytes, local *Location) (Time, bool)
|
||||
func parseStrictRFC3339(b []byte) (Time, error) {
|
||||
t, ok := parseRFC3339(b, Local)
|
||||
if !ok {
|
||||
if _, err := Parse(RFC3339, string(b)); err != nil {
|
||||
t, err := Parse(RFC3339, string(b))
|
||||
if err != nil {
|
||||
return Time{}, err
|
||||
}
|
||||
|
||||
@@ -164,6 +165,10 @@ func parseStrictRFC3339(b []byte) (Time, error) {
|
||||
// See https://go.dev/issue/54580.
|
||||
num2 := func(b []byte) byte { return 10*(b[0]-'0') + (b[1] - '0') }
|
||||
switch {
|
||||
// TODO(https://go.dev/issue/54580): Strict parsing is disabled for now.
|
||||
// Enable this again with a GODEBUG opt-out.
|
||||
case true:
|
||||
return t, nil
|
||||
case b[len("2006-01-02T")+1] == ':': // hour must be two digits
|
||||
return Time{}, &ParseError{RFC3339, string(b), "15", string(b[len("2006-01-02T"):][:1]), ""}
|
||||
case b[len("2006-01-02T15:04:05")] == ',': // sub-second separator must be a period
|
||||
|
||||
@@ -830,10 +830,10 @@ func TestUnmarshalInvalidTimes(t *testing.T) {
|
||||
}{
|
||||
{`{}`, "Time.UnmarshalJSON: input is not a JSON string"},
|
||||
{`[]`, "Time.UnmarshalJSON: input is not a JSON string"},
|
||||
{`"2000-01-01T1:12:34Z"`, `parsing time "2000-01-01T1:12:34Z" as "2006-01-02T15:04:05Z07:00": cannot parse "1" as "15"`},
|
||||
{`"2000-01-01T00:00:00,000Z"`, `parsing time "2000-01-01T00:00:00,000Z" as "2006-01-02T15:04:05Z07:00": cannot parse "," as "."`},
|
||||
{`"2000-01-01T00:00:00+24:00"`, `parsing time "2000-01-01T00:00:00+24:00": timezone hour out of range`},
|
||||
{`"2000-01-01T00:00:00+00:60"`, `parsing time "2000-01-01T00:00:00+00:60": timezone minute out of range`},
|
||||
{`"2000-01-01T1:12:34Z"`, `<nil>`},
|
||||
{`"2000-01-01T00:00:00,000Z"`, `<nil>`},
|
||||
{`"2000-01-01T00:00:00+24:00"`, `<nil>`},
|
||||
{`"2000-01-01T00:00:00+00:60"`, `<nil>`},
|
||||
{`"2000-01-01T00:00:00+123:45"`, `parsing time "2000-01-01T00:00:00+123:45" as "2006-01-02T15:04:05Z07:00": cannot parse "+123:45" as "Z07:00"`},
|
||||
}
|
||||
|
||||
@@ -842,13 +842,13 @@ func TestUnmarshalInvalidTimes(t *testing.T) {
|
||||
|
||||
want := tt.want
|
||||
err := json.Unmarshal([]byte(tt.in), &ts)
|
||||
if err == nil || err.Error() != want {
|
||||
if fmt.Sprint(err) != want {
|
||||
t.Errorf("Time.UnmarshalJSON(%s) = %v, want %v", tt.in, err, want)
|
||||
}
|
||||
|
||||
if strings.HasPrefix(tt.in, `"`) && strings.HasSuffix(tt.in, `"`) {
|
||||
err = ts.UnmarshalText([]byte(strings.Trim(tt.in, `"`)))
|
||||
if err == nil || err.Error() != want {
|
||||
if fmt.Sprint(err) != want {
|
||||
t.Errorf("Time.UnmarshalText(%s) = %v, want %v", tt.in, err, want)
|
||||
}
|
||||
}
|
||||
|
||||
19
test/fixedbugs/issue57778.go
Normal file
19
test/fixedbugs/issue57778.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// compile
|
||||
|
||||
// Copyright 2023 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 p
|
||||
|
||||
type FreeListG[T any] struct {
|
||||
freelist []*node[T]
|
||||
}
|
||||
|
||||
type node[T any] struct{}
|
||||
|
||||
func NewFreeListG[T any](size int) *FreeListG[T] {
|
||||
return &FreeListG[T]{freelist: make([]*node[T], 0, size)}
|
||||
}
|
||||
|
||||
var bf = NewFreeListG[*int](1024)
|
||||
76
test/fixedbugs/issue57823.go
Normal file
76
test/fixedbugs/issue57823.go
Normal file
@@ -0,0 +1,76 @@
|
||||
// run
|
||||
|
||||
// Copyright 2023 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 main
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
//go:noinline
|
||||
func g(x *byte) *byte { return x }
|
||||
|
||||
func main() {
|
||||
slice()
|
||||
str("AAAAAAAA", "BBBBBBBBB")
|
||||
}
|
||||
|
||||
func wait(done <-chan struct{}) bool {
|
||||
for i := 0; i < 10; i++ {
|
||||
runtime.GC()
|
||||
select {
|
||||
case <-done:
|
||||
return true
|
||||
default:
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func slice() {
|
||||
s := make([]byte, 100)
|
||||
s[0] = 1
|
||||
one := unsafe.SliceData(s)
|
||||
|
||||
done := make(chan struct{})
|
||||
runtime.SetFinalizer(one, func(*byte) { close(done) })
|
||||
|
||||
h := g(one)
|
||||
|
||||
if wait(done) {
|
||||
panic("GC'd early")
|
||||
}
|
||||
|
||||
if *h != 1 {
|
||||
panic("lost one")
|
||||
}
|
||||
|
||||
if !wait(done) {
|
||||
panic("never GC'd")
|
||||
}
|
||||
}
|
||||
|
||||
var strDone = make(chan struct{})
|
||||
|
||||
//go:noinline
|
||||
func str(x, y string) {
|
||||
s := x + y // put in temporary on stack
|
||||
p := unsafe.StringData(s)
|
||||
runtime.SetFinalizer(p, func(*byte) { close(strDone) })
|
||||
|
||||
if wait(strDone) {
|
||||
panic("GC'd early")
|
||||
}
|
||||
|
||||
if *p != 'A' {
|
||||
panic("lost p")
|
||||
}
|
||||
|
||||
if !wait(strDone) {
|
||||
panic("never GC'd")
|
||||
}
|
||||
}
|
||||
@@ -1053,11 +1053,6 @@ func issue51622(b []byte) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func issue45928(x int) {
|
||||
combinedFrac := (x) / (x | (1 << 31)) // ERROR "Proved Neq64$"
|
||||
useInt(combinedFrac)
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func useInt(a int) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user