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

Compiler: remove macro def #5040

Merged
merged 1 commit into from Sep 26, 2017
Merged

Compiler: remove macro def #5040

merged 1 commit into from Sep 26, 2017

Conversation

asterite
Copy link
Member

@asterite asterite commented Sep 26, 2017

Fixes #2565

Since a long time now macro def has no use and can be replaced with a regular def that mentions @type inside macro code. The logic is that if @type isn't mentioned there's no need for the method to be instantiated for each particular subtype of the class.

macro def wasn't used at all in the whole source code, except a few specs. These specs were kept, though, because macro defs are a concept of their own.

@asterite asterite self-assigned this Sep 26, 2017
@@ -3266,7 +3259,7 @@ module Crystal
@doc_enabled = !!@wants_doc
pop_def

node = Def.new name, args, body, receiver, block_arg, return_type, (is_macro_def || @is_macro_def), @yields, is_abstract, splat_index, double_splat: double_splat, free_vars: free_vars
node = Def.new name, args, body, receiver, block_arg, return_type, @is_macro_def, @yields, is_abstract, splat_index, double_splat: double_splat, free_vars: free_vars
Copy link
Contributor

@Sija Sija Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is @is_macro_def argument still needed?

Copy link
Member Author

@asterite asterite Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a def that mentions @type inside macro code is a macro def. So the concept exists and still remains, you just don't have to make it explicit with macro def.

RX14
RX14 approved these changes Sep 26, 2017
@RX14 RX14 added this to the Next milestone Sep 26, 2017
@RX14 RX14 merged commit 2c1bb2d into crystal-lang:master Sep 26, 2017
2 checks passed
makenowjust added a commit to makenowjust/crystal that referenced this issue Sep 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants