mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 20:17:42 +00:00
Fix string stream crashing when created on nimscript due to last fix (#19717)
(cherry picked from commit dc4cc2dca5)
This commit is contained in:
@@ -1271,7 +1271,7 @@ else: # after 1.3 or JS not defined
|
||||
|
||||
new(result)
|
||||
result.data = s
|
||||
when defined(gcOrc) or defined(gcArc):
|
||||
when declared(prepareMutation):
|
||||
prepareMutation(result.data) # Allows us to mutate using `addr` logic like `copyMem`, otherwise it errors.
|
||||
result.pos = 0
|
||||
result.closeImpl = ssClose
|
||||
|
||||
@@ -76,3 +76,7 @@ block:
|
||||
doAssert(ss.getPosition == 5) # haven't moved
|
||||
ss.setPosition(0) # Ensure we dont error with writing over literals on arc/orc #19707
|
||||
ss.write("hello")
|
||||
|
||||
static: # Ensure streams it doesnt break with nimscript on arc/orc #19716
|
||||
let s = newStringStream("a")
|
||||
discard s.data
|
||||
|
||||
Reference in New Issue
Block a user