remove exception (#18906)

(cherry picked from commit 4d8108046b)
This commit is contained in:
flywind
2021-10-22 18:15:08 +08:00
committed by narimiran
parent a5a2c57e88
commit 2f247ed1a7
2 changed files with 8 additions and 7 deletions

View File

@@ -292,13 +292,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode; idgen: IdGenerator; g: ModuleGraph): P
else: result = newStrNodeT("true", n, g)
of mFloatToStr: result = newStrNodeT($getFloat(a), n, g)
of mCStrToStr, mCharToStr:
if a.kind == nkBracket:
var s = ""
for b in a.sons:
s.add b.getStrOrChar
result = newStrNodeT(s, n, g)
else:
result = newStrNodeT(getStrOrChar(a), n, g)
result = newStrNodeT(getStrOrChar(a), n, g)
of mStrToStr: result = newStrNodeT(getStrOrChar(a), n, g)
of mEnumToStr: result = newStrNodeT(ordinalValToString(a, g), n, g)
of mArrToSeq:

View File

@@ -187,5 +187,12 @@ proc main()=
test2 high(int8), "127"
test2 low(int8), "-128"
block:
const
a: array[3, char] = ['N', 'i', 'm']
aStr = $(a)
doAssert aStr == """['N', 'i', 'm']"""
static: main()
main()