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

Can't use self in toplevel method #5227



Copy link

Related issue #5225

Now the compiler shows right error message:

def foo
  self # raise: there's no self in this scope


Copy link

asterite commented Nov 1, 2017

I'm thiking, maybe self should parse to a Self node so we don't have to do .name == "self" in every var access.

Copy link

asterite commented Nov 1, 2017

Actually, nevermind. It's a huge refactor, let's not do that now. But maybe I'd change the condition, do if var.type?.is_a?(Program) && == "self". That should be slightly faster.

@makenowjust makenowjust force-pushed the fix/crystal/no-self-in-toplevel-method branch from 880d42f to de137c0 Compare November 1, 2017 14:31
@RX14 RX14 added this to the Next milestone Nov 2, 2017
@RX14 RX14 merged commit 7acedf8 into crystal-lang:master Nov 2, 2017
@makenowjust makenowjust deleted the fix/crystal/no-self-in-toplevel-method branch November 3, 2017 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants