diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-09-09 07:32:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 07:32:03 +0200 |
commit | 10988d48407e96b707b28c5900fcb0e59354e00a (patch) | |
tree | b214c60feeec87fcec7393a5e81159e719fd2085 /compiler/sempass2.nim | |
parent | c49b88163c12d18506ef43e4d26abd5d76f68359 (diff) | |
download | Nim-10988d48407e96b707b28c5900fcb0e59354e00a.tar.gz |
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
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r-- | compiler/sempass2.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index f745f9075..b48d7e29e 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -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: |