refactor strongSpaceB with an enum (#20809)

refactor strongSpaceB
This commit is contained in:
ringabout 2022-11-10 23:21:52 +08:00 • committed by GitHub
commit a15872ba9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 23 deletions

View file

@ -272,7 +272,7 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) =
if not em.endsInWhite: wr(" ")
wr(tok.ident.s)
template isUnary(tok): bool =
tok.strongSpaceB == 0 and tok.strongSpaceA
tok.strongSpaceB == tsNone and tok.strongSpaceA
if not isUnary(tok) or em.lastTok in {tkOpr, tkDotDot}:
wr(" ")