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

ng/eval: defer outside a function scope #210

Closed
sbinet opened this issue Jan 16, 2018 · 0 comments
Closed

ng/eval: defer outside a function scope #210

sbinet opened this issue Jan 16, 2018 · 0 comments
Assignees

Comments

@sbinet
Copy link
Collaborator

sbinet commented Jan 16, 2018

right now, when doing this (in Jupyter or directly in ng) one gets:

ng> import "os"
ng> f, err := os.Create("foo")
ng> if err != nil { panic(err) }
ng> defer f.Close()
ng: defer outside a function scope

as mentioned here we should probably put all the top-level code insider a "fake" "ng-main" function scope so we get a defer-context to hang all the top-level defers on to.

what do you think @crawshaw ?
would this break something somewhere?
(go test ./... didn't complain)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant