summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-09-13 17:33:20 +0200
committerAraq <rumpf_a@web.de>2012-09-13 17:33:20 +0200
commitd336cb4957c6b223ce7e8d717718217cb0665b56 (patch)
treebe009376c85e0076de6926a80b6eadc6e36ab3fb /compiler
parenta783077cfde0f542c1cc155fde617b0ceb977b21 (diff)
downloadNim-d336cb4957c6b223ce7e8d717718217cb0665b56.tar.gz
bugfix: echo vs debugEcho
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/semexprs.nim3
-rw-r--r--compiler/sempass2.nim27
2 files changed, 25 insertions, 5 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index e53db7cec..d60879e0b 100755
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -686,6 +686,9 @@ proc semEcho(c: PContext, n: PNode): PNode =
   for i in countup(1, sonsLen(n) - 1): 
     var arg = semExprWithType(c, n.sons[i])
     n.sons[i] = semExpr(c, buildStringify(c, arg))
+  
+  let t = n.sons[0].typ
+  if tfNoSideEffect notin t.flags: incl(c.p.owner.flags, sfSideEffect)
   result = n
   
 proc buildEchoStmt(c: PContext, n: PNode): PNode = 
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index 78653bb44..9b00901bb 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -7,7 +7,8 @@
 #    distribution, for details about the copyright.
 #
 
-#  included from sem.nim
+import
+  ast, astalgo, msgs, semdata
 
 # Second semantic checking pass over the AST. Necessary because the old
 # way had some inherent problems. Performs:
@@ -15,9 +16,25 @@
 # * procvar checks
 # * effect tracking
 # * closure analysis
-# * checks for invalid usages of compiletime magics
-# * checks for invalid usages of PNimNode
+# * checks for invalid usages of compiletime magics (not implemented)
+# * checks for invalid usages of PNimNode (not implemented)
 # * later: will do an escape analysis for closures at least
 
-proc sem2(c: PContext, n: PNode): PNode =
-  nil
+# Predefined effects:
+#   io, time (time dependent), gc (performs GC'ed allocation), exceptions,
+#   side effect (accesses global), store (stores into *type*),
+#   store_unkown (performs some store) --> store(any)|store(x) 
+#   load (loads from *type*), recursive (recursive call),
+#   endless (has endless loops), --> user effects are defined over *patterns*
+#   --> a TR macro can annotate the proc with user defined annotations
+#   --> the effect system can access these
+
+proc sem2call(c: PContext, n: PNode): PNode =
+  assert n.kind in nkCallKinds
+  
+  
+
+proc sem2sym(c: PContext, n: PNode): PNode =
+  assert n.kind == nkSym
+  
+