added toOpenArray builtin for zero-copy slices; syntax sugar yet to come

This commit is contained in:
Araq 2018-03-24 20:26:20 +01:00
commit 1d9343080d
6 changed files with 84 additions and 14 deletions

View file

@ -346,7 +346,9 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
if c.inGenericContext == 0:
instantiateBody(c, n, fn.typ.n, result, fn)
sideEffectsCheck(c, result)
paramsTypeCheck(c, result.typ)
if result.magic != mSlice:
# 'toOpenArray' is special and it is allowed to return 'openArray':
paramsTypeCheck(c, result.typ)
else:
result = oldPrc
popProcCon(c)