mirror of https://github.com/golang/go.git
src: a/an grammar fixes
This commit is contained in:
parent
631a6c2abf
commit
2e2d9c1e45
|
|
@ -70,7 +70,7 @@ func staticCall(call *ir.CallExpr) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// If typ *has* a shape type, then it's an shaped, instantiated
|
// If typ *has* a shape type, then it's a shaped, instantiated
|
||||||
// type like T[go.shape.int], and its methods (may) have an extra
|
// type like T[go.shape.int], and its methods (may) have an extra
|
||||||
// dictionary parameter. We could devirtualize this call if we
|
// dictionary parameter. We could devirtualize this call if we
|
||||||
// could derive an appropriate dictionary argument.
|
// could derive an appropriate dictionary argument.
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import (
|
||||||
// e.value(k, n.Left)
|
// e.value(k, n.Left)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// An location represents an abstract location that stores a Go
|
// A location represents an abstract location that stores a Go
|
||||||
// variable.
|
// variable.
|
||||||
type location struct {
|
type location struct {
|
||||||
n ir.Node // represented variable or expression, if any
|
n ir.Node // represented variable or expression, if any
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,7 @@ func NewKeyExpr(pos src.XPos, key, value Node) *KeyExpr {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
// A StructKeyExpr is an Field: Value composite literal key.
|
// A StructKeyExpr is a Field: Value composite literal key.
|
||||||
type StructKeyExpr struct {
|
type StructKeyExpr struct {
|
||||||
miniExpr
|
miniExpr
|
||||||
Field *types.Field
|
Field *types.Field
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ func smagicOK(n uint, c int64) bool {
|
||||||
return c&(c-1) != 0
|
return c&(c-1) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// smagicOKn reports whether we should strength reduce an signed n-bit divide by c.
|
// smagicOKn reports whether we should strength reduce a signed n-bit divide by c.
|
||||||
func smagicOK8(c int8) bool { return smagicOK(8, int64(c)) }
|
func smagicOK8(c int8) bool { return smagicOK(8, int64(c)) }
|
||||||
func smagicOK16(c int16) bool { return smagicOK(16, int64(c)) }
|
func smagicOK16(c int16) bool { return smagicOK(16, int64(c)) }
|
||||||
func smagicOK32(c int32) bool { return smagicOK(32, int64(c)) }
|
func smagicOK32(c int32) bool { return smagicOK(32, int64(c)) }
|
||||||
|
|
|
||||||
|
|
@ -954,7 +954,7 @@ func hasVarSize(t Type, seen map[*Named]bool) (varSized bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// applyTypeFunc applies f to x. If x is a type parameter,
|
// applyTypeFunc applies f to x. If x is a type parameter,
|
||||||
// the result is a type parameter constrained by an new
|
// the result is a type parameter constrained by a new
|
||||||
// interface bound. The type bounds for that interface
|
// interface bound. The type bounds for that interface
|
||||||
// are computed by applying f to each of the type bounds
|
// are computed by applying f to each of the type bounds
|
||||||
// of x. If any of these applications of f return nil,
|
// of x. If any of these applications of f return nil,
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ func walkClosure(clo *ir.ClosureExpr, init *ir.Nodes) ir.Node {
|
||||||
return walkExpr(cfn, init)
|
return walkExpr(cfn, init)
|
||||||
}
|
}
|
||||||
|
|
||||||
// closureArgs returns a slice of expressions that an be used to
|
// closureArgs returns a slice of expressions that can be used to
|
||||||
// initialize the given closure's free variables. These correspond
|
// initialize the given closure's free variables. These correspond
|
||||||
// one-to-one with the variables in clo.Func.ClosureVars, and will be
|
// one-to-one with the variables in clo.Func.ClosureVars, and will be
|
||||||
// either an ONAME node (if the variable is captured by value) or an
|
// either an ONAME node (if the variable is captured by value) or an
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
|
||||||
// NOP
|
// NOP
|
||||||
//
|
//
|
||||||
// The NOP is needed to give the jumps somewhere to land.
|
// The NOP is needed to give the jumps somewhere to land.
|
||||||
// It is a liblink NOP, not an hardware NOP: it encodes to 0 instruction bytes.
|
// It is a liblink NOP, not a hardware NOP: it encodes to 0 instruction bytes.
|
||||||
//
|
//
|
||||||
// We don't generate this for leafs because that means the wrapped
|
// We don't generate this for leafs because that means the wrapped
|
||||||
// function was inlined into the wrapper.
|
// function was inlined into the wrapper.
|
||||||
|
|
|
||||||
|
|
@ -988,7 +988,7 @@ func (l *Loader) AttrExternal(i Sym) bool {
|
||||||
return l.attrExternal.Has(l.extIndex(i))
|
return l.attrExternal.Has(l.extIndex(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAttrExternal sets the "external" property for an host object
|
// SetAttrExternal sets the "external" property for a host object
|
||||||
// symbol (see AttrExternal).
|
// symbol (see AttrExternal).
|
||||||
func (l *Loader) SetAttrExternal(i Sym, v bool) {
|
func (l *Loader) SetAttrExternal(i Sym, v bool) {
|
||||||
if !l.IsExternal(i) {
|
if !l.IsExternal(i) {
|
||||||
|
|
|
||||||
|
|
@ -953,7 +953,7 @@ func hasVarSize(t Type, seen map[*Named]bool) (varSized bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// applyTypeFunc applies f to x. If x is a type parameter,
|
// applyTypeFunc applies f to x. If x is a type parameter,
|
||||||
// the result is a type parameter constrained by an new
|
// the result is a type parameter constrained by a new
|
||||||
// interface bound. The type bounds for that interface
|
// interface bound. The type bounds for that interface
|
||||||
// are computed by applying f to each of the type bounds
|
// are computed by applying f to each of the type bounds
|
||||||
// of x. If any of these applications of f return nil,
|
// of x. If any of these applications of f return nil,
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@ func isGateway(h string) bool {
|
||||||
return stringsEqualFold(h, "_gateway")
|
return stringsEqualFold(h, "_gateway")
|
||||||
}
|
}
|
||||||
|
|
||||||
// isOutbound reports whether h should be considered a "outbound"
|
// isOutbound reports whether h should be considered an "outbound"
|
||||||
// name for the myhostname NSS module.
|
// name for the myhostname NSS module.
|
||||||
func isOutbound(h string) bool {
|
func isOutbound(h string) bool {
|
||||||
return stringsEqualFold(h, "_outbound")
|
return stringsEqualFold(h, "_outbound")
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ type netFD struct {
|
||||||
raddr Addr
|
raddr Addr
|
||||||
|
|
||||||
// The only networking available in WASI preview 1 is the ability to
|
// The only networking available in WASI preview 1 is the ability to
|
||||||
// sock_accept on an pre-opened socket, and then fd_read, fd_write,
|
// sock_accept on a pre-opened socket, and then fd_read, fd_write,
|
||||||
// fd_close, and sock_shutdown on the resulting connection. We
|
// fd_close, and sock_shutdown on the resulting connection. We
|
||||||
// intercept applicable netFD calls on this instance, and then pass
|
// intercept applicable netFD calls on this instance, and then pass
|
||||||
// the remainder of the netFD calls to fakeNetFD.
|
// the remainder of the netFD calls to fakeNetFD.
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ type Transport struct {
|
||||||
|
|
||||||
// TLSNextProto specifies how the Transport switches to an
|
// TLSNextProto specifies how the Transport switches to an
|
||||||
// alternate protocol (such as HTTP/2) after a TLS ALPN
|
// alternate protocol (such as HTTP/2) after a TLS ALPN
|
||||||
// protocol negotiation. If Transport dials an TLS connection
|
// protocol negotiation. If Transport dials a TLS connection
|
||||||
// with a non-empty protocol name and TLSNextProto contains a
|
// with a non-empty protocol name and TLSNextProto contains a
|
||||||
// map entry for that key (such as "h2"), then the func is
|
// map entry for that key (such as "h2"), then the func is
|
||||||
// called with the request's authority (such as "example.com"
|
// called with the request's authority (such as "example.com"
|
||||||
|
|
|
||||||
|
|
@ -581,7 +581,7 @@ func TestStatLxSymLink(t *testing.T) {
|
||||||
}
|
}
|
||||||
if m := fi.Mode(); m&fs.ModeSymlink != 0 {
|
if m := fi.Mode(); m&fs.ModeSymlink != 0 {
|
||||||
// This can happen depending on newer WSL versions when running as admin or in developer mode.
|
// This can happen depending on newer WSL versions when running as admin or in developer mode.
|
||||||
t.Skip("skipping: WSL created reparse tag IO_REPARSE_TAG_SYMLINK instead of a IO_REPARSE_TAG_LX_SYMLINK")
|
t.Skip("skipping: WSL created reparse tag IO_REPARSE_TAG_SYMLINK instead of an IO_REPARSE_TAG_LX_SYMLINK")
|
||||||
}
|
}
|
||||||
// Stat'ing a IO_REPARSE_TAG_LX_SYMLINK from outside WSL always return ERROR_CANT_ACCESS_FILE.
|
// Stat'ing a IO_REPARSE_TAG_LX_SYMLINK from outside WSL always return ERROR_CANT_ACCESS_FILE.
|
||||||
// We check this condition to validate that os.Stat has tried to follow the link.
|
// We check this condition to validate that os.Stat has tried to follow the link.
|
||||||
|
|
|
||||||
|
|
@ -4749,7 +4749,7 @@ func TestConvertSlice2Array(t *testing.T) {
|
||||||
// Converting a slice to non-empty array needs to return
|
// Converting a slice to non-empty array needs to return
|
||||||
// a non-addressable copy of the original memory.
|
// a non-addressable copy of the original memory.
|
||||||
if v.CanAddr() {
|
if v.CanAddr() {
|
||||||
t.Fatalf("convert slice to non-empty array returns a addressable copy array")
|
t.Fatalf("convert slice to non-empty array returns an addressable copy array")
|
||||||
}
|
}
|
||||||
for i := range s {
|
for i := range s {
|
||||||
ov.Index(i).Set(ValueOf(i + 1))
|
ov.Index(i).Set(ValueOf(i + 1))
|
||||||
|
|
|
||||||
|
|
@ -567,7 +567,7 @@ func interfaceSwitch(s *abi.InterfaceSwitch, t *_type) (int, *itab) {
|
||||||
return case_, tab
|
return case_, tab
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildInterfaceSwitchCache constructs a interface switch cache
|
// buildInterfaceSwitchCache constructs an interface switch cache
|
||||||
// containing all the entries from oldC plus the new entry
|
// containing all the entries from oldC plus the new entry
|
||||||
// (typ,case_,tab).
|
// (typ,case_,tab).
|
||||||
func buildInterfaceSwitchCache(oldC *abi.InterfaceSwitchCache, typ *_type, case_ int, tab *itab) *abi.InterfaceSwitchCache {
|
func buildInterfaceSwitchCache(oldC *abi.InterfaceSwitchCache, typ *_type, case_ int, tab *itab) *abi.InterfaceSwitchCache {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ func TestReadMetrics(t *testing.T) {
|
||||||
oldLimit := debug.SetMemoryLimit(limit)
|
oldLimit := debug.SetMemoryLimit(limit)
|
||||||
defer debug.SetMemoryLimit(oldLimit)
|
defer debug.SetMemoryLimit(oldLimit)
|
||||||
|
|
||||||
// Set an GC percent to check the metric for it
|
// Set a GC percent to check the metric for it
|
||||||
gcPercent := 99
|
gcPercent := 99
|
||||||
oldGCPercent := debug.SetGCPercent(gcPercent)
|
oldGCPercent := debug.SetGCPercent(gcPercent)
|
||||||
defer debug.SetGCPercent(oldGCPercent)
|
defer debug.SetGCPercent(oldGCPercent)
|
||||||
|
|
|
||||||
|
|
@ -1377,7 +1377,7 @@ func (c *gcControllerState) needIdleMarkWorker() bool {
|
||||||
return n < max
|
return n < max
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeIdleMarkWorker must be called when an new idle mark worker stops executing.
|
// removeIdleMarkWorker must be called when a new idle mark worker stops executing.
|
||||||
func (c *gcControllerState) removeIdleMarkWorker() {
|
func (c *gcControllerState) removeIdleMarkWorker() {
|
||||||
for {
|
for {
|
||||||
old := c.idleMarkWorkers.Load()
|
old := c.idleMarkWorkers.Load()
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ func raceSymbolizeCode(ctx *symbolizeCodeContext) {
|
||||||
// Ignore wrappers, unless we're at the outermost frame of u.
|
// Ignore wrappers, unless we're at the outermost frame of u.
|
||||||
// A non-inlined wrapper frame always means we have a physical
|
// A non-inlined wrapper frame always means we have a physical
|
||||||
// frame consisting entirely of wrappers, in which case we'll
|
// frame consisting entirely of wrappers, in which case we'll
|
||||||
// take a outermost wrapper over nothing.
|
// take an outermost wrapper over nothing.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ func Map(mapping func(rune) rune, s string) string {
|
||||||
if r < utf8.RuneSelf {
|
if r < utf8.RuneSelf {
|
||||||
b.WriteByte(byte(r))
|
b.WriteByte(byte(r))
|
||||||
} else {
|
} else {
|
||||||
// r is not a ASCII rune.
|
// r is not an ASCII rune.
|
||||||
b.WriteRune(r)
|
b.WriteRune(r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ func TestCompareAndSwap_NonExistingKey(t *testing.T) {
|
||||||
m := &sync.Map{}
|
m := &sync.Map{}
|
||||||
if m.CompareAndSwap(m, nil, 42) {
|
if m.CompareAndSwap(m, nil, 42) {
|
||||||
// See https://go.dev/issue/51972#issuecomment-1126408637.
|
// See https://go.dev/issue/51972#issuecomment-1126408637.
|
||||||
t.Fatalf("CompareAndSwap on an non-existing key succeeded")
|
t.Fatalf("CompareAndSwap on a non-existing key succeeded")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue