Skip to content

Conversation

straight-shoota
Copy link
Member

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

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:formatter labels Jan 30, 2024
@straight-shoota straight-shoota self-assigned this Jan 30, 2024
@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
@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

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants