From a95b6391fd353074daf2dbfed4d73e8d57f314ca Mon Sep 17 00:00:00 2001 From: metagn Date: Thu, 1 Sep 2022 19:10:00 +0300 Subject: support cstring in `case` (#20130) * implement case for cstring for now just converts to string on C backend * custom implementation for cstring * remove leftover * revert even more * add nil + fix packages weird variant literal bug * update docs --- compiler/ccgstmts.nim | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'compiler/ccgstmts.nim') diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 0d17031df..0980de98f 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -837,17 +837,27 @@ template genCaseGeneric(p: BProc, t: PNode, d: var TLoc, fixLabel(p, lend) proc genCaseStringBranch(p: BProc, b: PNode, e: TLoc, labl: TLabel, + stringKind: TTypeKind, branches: var openArray[Rope]) = var x: TLoc for i in 0..= $2 && $1 <= $3) goto $4;$n", "if ($1 == $2) goto $3;$n") -- cgit 1.4.1-2-gfad0