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

Refactor symbol quoting into Symbol.quote_for_named_argument #13595

Merged

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Jun 22, 2023

Every call to Symbol.needs_quotes_for_named_argument? in the compiler and stdlib is used in the same manner to decide whether to use the parameter directly or with inspect. All call sites look like this:

if Symbol.needs_quotes_for_named_argument?(x)
   x.inspect
else
  x
end

This PR extracts that common logic into a helper method Symbol.quote_for_named_argument.
Like .needs_quotes_for_named_argument?, it's nodoc.

All calls to Symbol.needs_quotes_for_named_argument? are replaced by Symbol.quote_for_named_argument, and the former is marked as deprecated.
It's a nodoc method, so this would not be absolutely necessary and we could just remove it right away. But it's still nice to keep it available for some time (at least till the next release).

src/symbol.cr Outdated Show resolved Hide resolved
@straight-shoota straight-shoota added this to the 1.9.0 milestone Jun 23, 2023
@straight-shoota straight-shoota merged commit 2629403 into crystal-lang:master Jun 24, 2023
@straight-shoota straight-shoota deleted the refactor/symbol-quote branch June 24, 2023 23:17
Blacksmoke16 pushed a commit to Blacksmoke16/crystal that referenced this pull request Dec 11, 2023
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.

2 participants