Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: possible typo in ssa.go #16139

Closed
gyuho opened this issue Jun 21, 2016 · 2 comments
Closed

cmd/compile: possible typo in ssa.go #16139

gyuho opened this issue Jun 21, 2016 · 2 comments

Comments

@gyuho
Copy link
Contributor

gyuho commented Jun 21, 2016

https://github.com/golang/go/blob/master/src/cmd/compile/internal/gc/ssa.go#L3699

// checkgoto checks that a goto from from to to does not
// jump into a block or jump over variable declarations.
// It is a copy of checkgoto in the pre-SSA backend,
// modified only for line number handling.
// TODO: document how this works and why it is designed the way it is.
func (s *state) checkgoto(from *Node, to *Node) {
    if from.Sym == to.Sym {
        return
    }
...

I just came across this cryptic comment from from to to.
Is this typo? If not, can anybody help me understand this comment?

If it's not a typo, please feel free to close this :)

Thanks a lot!

@ALTree
Copy link
Member

ALTree commented Jun 21, 2016

// checkgoto checks that a goto from [the] from [parameter] to [the] to [parameter] does not...

i.e. in "from from to to" the second "from" and the second "to" are referring to the two parameters of the function.

@gyuho
Copy link
Contributor Author

gyuho commented Jun 21, 2016

@ALTree Makes sense. Thanks for providing the contexts!

@gyuho gyuho closed this as completed Jun 21, 2016
@golang golang locked and limited conversation to collaborators Jun 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants