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

Fix format for asm with comments #14278

Merged

Conversation

straight-shoota
Copy link
Member

Fixes a formatter bug that appeared in crystal-lang/crystal-book#746

@HertzDevil
Copy link
Contributor

HertzDevil commented Jan 30, 2024

This still formats that asm expression into:

asm(
  # the assembly template string, following the
  # syntax for LLVM's integrated assembler
  "nop" :               # output operands
 "=r"(foo), "=r"(bar) : # input operands
 "r"(1), "r"(baz) :     # names of clobbered registers
 "eax", "memory" :      # optional flags, corresponding to the LLVM IR
  # sideeffect / alignstack / inteldialect / unwind attributes
 "volatile", "alignstack", "intel", "unwind"
)

The 3 comment lines have the correct indentation, but that's about it. That snippet is supposed to be the correct formatting already, given that defs can do the same.

@straight-shoota
Copy link
Member Author

Argh, should've tested the entire snippet again.

Ouh yeah, there's a hard coded write " " in visit_asm_parts.

Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
@straight-shoota straight-shoota added this to the 1.12.0 milestone Feb 1, 2024
@straight-shoota straight-shoota merged commit 3ba4291 into crystal-lang:master Feb 2, 2024
56 of 57 checks passed
@straight-shoota straight-shoota deleted the fix/format-asm-comment branch February 2, 2024 13:22
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