Skip to content

Commit

Permalink
fix word "inner" or "internal" to "local"
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoh86 committed Jul 10, 2020
1 parent 532589e commit 6793c6b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -32,8 +32,8 @@ func main() {
var vArray [4]*int
var v *int
if i%2 == 0 {
v = &p // not a diagnostic (x is inner variable)
vArray[1] = &p // not a diagnostic (x is inner variable)
v = &p // not a diagnostic (x is local variable)
vArray[1] = &p // not a diagnostic (x is local variable)
vStr.x = &p
}
_ = v
Expand Down Expand Up @@ -72,7 +72,7 @@ func main() {

println("loop expecting 10, 11, 12, 13")
for i, p := range []int{10, 11, 12, 13} {
p := p // FIX variable into the inner variable
p := p // FIX variable into the local variable
printp(&p)
intSlice = append(intSlice, &p)
intArray[i] = &p
Expand Down
6 changes: 3 additions & 3 deletions exportloopref.go
Expand Up @@ -61,7 +61,7 @@ type Searcher struct {
// - var <X> int
// - D := ...
Stats map[token.Pos]struct{}
// Internal variables maps loop-position, decl-location to ignore
// Local variables maps loop-position, decl-location to ignore
// safe pointers for variable which declared in the loop.
Vars map[token.Pos]map[token.Pos]struct{}
Types map[ast.Expr]types.TypeAndValue
Expand Down Expand Up @@ -130,7 +130,7 @@ func (s *Searcher) parseAssignStmt(n *ast.AssignStmt, stack []ast.Node) {
return
}

// Find statements declaring internal variable
// Find statements declaring local variable
if n.Tok == token.DEFINE {
for _, h := range n.Lhs {
s.addVar(loop, h)
Expand Down Expand Up @@ -219,7 +219,7 @@ func (s *Searcher) checkUnaryExpr(n *ast.UnaryExpr, stack []ast.Node) (*ast.Iden
}
}

// check Lhs[x] is not inner variable
// check Lhs[x] is not local variable
lh := typed.Lhs[index]
isVar := s.isVar(loop, lh)
if !isVar {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/fixed/fixed.go
Expand Up @@ -8,7 +8,7 @@ func main() {

println("loop expecting 10, 11, 12, 13")
for i, p := range []int{10, 11, 12, 13} {
p := p // FIX variable into the inner variable
p := p // FIX variable into the local variable
printp(&p)
slice = append(slice, &p)
array[i] = &p
Expand Down
4 changes: 2 additions & 2 deletions testdata/src/simple/simple.go
Expand Up @@ -19,8 +19,8 @@ func main() {
var vArray [4]*int
var v *int
if i%2 == 0 {
v = &p // not a diagnostic (x is inner variable)
vArray[1] = &p // not a diagnostic (x is inner variable)
v = &p // not a diagnostic (x is local variable)
vArray[1] = &p // not a diagnostic (x is local variable)
vStr.x = &p
}
_ = v
Expand Down

0 comments on commit 6793c6b

Please sign in to comment.