borrow checking (#15282)

* refactoring: move procs to typeallowed.nim
* frontend preparations for first class openArray support
* prepare the code generator for first class openArray
* code generation for first class openArray; WIP
* code generation for open arrays, progress
* added isViewType proc
* preparations for borrow checking
* added borrow checking to the front end
This commit is contained in:
Andreas Rumpf 2020-09-09 07:32:03 +02:00 • committed by GitHub
commit 10988d4840
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 554 additions and 311 deletions

View file

@ -1243,8 +1243,11 @@ proc trackProc*(c: PContext; s: PSym, body: PNode) =
effects[ensuresEffects] = ensuresSpec
var mutationInfo = MutationInfo()
if strictFuncs in c.features and not t.hasSideEffect and t.hasDangerousAssign:
t.hasSideEffect = mutatesNonVarParameters(s, body, mutationInfo)
if {strictFuncs, views} * c.features != {}:
var partitions = computeGraphPartitions(s, body)
if not t.hasSideEffect and t.hasDangerousAssign:
t.hasSideEffect = varpartitions.hasSideEffect(partitions, mutationInfo)
checkBorrowedLocations(partitions, g.config)
if sfThread in s.flags and t.gcUnsafe:
if optThreads in g.config.globalOptions and optThreadAnalysis in g.config.globalOptions: