summary refs log tree commit diff stats
path: root/compiler/astalgo.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-03-23 00:12:05 +0100
committerGitHub <noreply@github.com>2019-03-23 00:12:05 +0100
commitbf592c4e944e9cca8a2bb60f52b5b39388c4ed4c (patch)
treef5a7eddcae6fca19dd785a975e2f885f88ff8007 /compiler/astalgo.nim
parent25649616ea5b6aba575149df3f9943f48a5ece31 (diff)
downloadNim-bf592c4e944e9cca8a2bb60f52b5b39388c4ed4c.tar.gz
more destructor based changes (#10885)
* mark user defined destructors with sfOverriden to simplify the logic
* refactoring in preparation to merge liftings and generic instantiations for destructors
* ast: introduce nkHiddenTryStmt for destructor generation in order to be able to optimize better the code later on
* renamed 'patterns' switch to 'trmacros' as it was totally misleading before
* destructors: introduce tfCheckedForDestructor flag in preparation of strict =destroy checking
* test for invalid/too late destructor introductions
* liftdestructors: make code robust for nimsuggest
* --newruntime works for hello world again
* newruntime: code generation for closures
Diffstat (limited to 'compiler/astalgo.nim')
-rw-r--r--compiler/astalgo.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim
index 839c4645d..4320ffea3 100644
--- a/compiler/astalgo.nim
+++ b/compiler/astalgo.nim
@@ -1002,7 +1002,7 @@ proc iiTablePut(t: var TIITable, key, val: int) =
     iiTableRawInsert(t.data, key, val)
     inc(t.counter)
 
-proc isAddrNode*(n: PNode): bool = 
+proc isAddrNode*(n: PNode): bool =
   case n.kind
     of nkAddr, nkHiddenAddr: true
     of nkCallKinds:
ound-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
discard """
  output: '''
to be, or not to be
(v: 1)
(v: 1)
'''
  joinable: false
"""

import sequtils, sugar

let m = @[proc (s: string): string = "to " & s, proc (s: string): string = "not to " & s]
var l = m.mapIt(capture([it], proc (s: string): string = it(s)))
let r = l.mapIt(it("be"))
echo r[0] & ", or " & r[1]

type O = object
  v: int
var o = O(v: 1)
var execute: proc()
capture [o]:
  execute = proc() =
    echo o
execute()
o.v = -1
execute()