summary refs log tree commit diff stats
path: root/compiler/nimsets.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-07-30 23:07:19 +0200
committerAraq <rumpf_a@web.de>2012-07-30 23:07:19 +0200
commit674c05f426d586deba1401270f78b74c22c540bc (patch)
tree320432ef06fcfc607ef0e65ab416b84c03803716 /compiler/nimsets.nim
parentb0c11d3efbcfc3cd2e8d852ec196930ebace91ad (diff)
downloadNim-674c05f426d586deba1401270f78b74c22c540bc.tar.gz
made compiler more robust for idetools; implemented idetools.usages
Diffstat (limited to 'compiler/nimsets.nim')
-rwxr-xr-xcompiler/nimsets.nim20
1 files changed, 13 insertions, 7 deletions
diff --git a/compiler/nimsets.nim b/compiler/nimsets.nim
index d475c7b59..282188c64 100755
--- a/compiler/nimsets.nim
+++ b/compiler/nimsets.nim
@@ -31,7 +31,9 @@ proc cardSet*(s: PNode): BiggestInt
 # implementation
 
 proc inSet(s: PNode, elem: PNode): bool = 
-  if s.kind != nkCurly: InternalError(s.info, "inSet")
+  if s.kind != nkCurly: 
+    InternalError(s.info, "inSet")
+    return false
   for i in countup(0, sonsLen(s) - 1): 
     if s.sons[i].kind == nkRange: 
       if leValue(s.sons[i].sons[0], elem) and
@@ -48,17 +50,19 @@ proc overlap(a, b: PNode): bool =
       result = leValue(a.sons[0], b.sons[1]) and
           leValue(b.sons[1], a.sons[1]) or
           leValue(a.sons[0], b.sons[0]) and leValue(b.sons[0], a.sons[1])
-    else: 
+    else:
       result = leValue(a.sons[0], b) and leValue(b, a.sons[1])
-  else: 
-    if b.kind == nkRange: 
+  else:
+    if b.kind == nkRange:
       result = leValue(b.sons[0], a) and leValue(a, b.sons[1])
-    else: 
+    else:
       result = sameValue(a, b)
 
 proc SomeInSet(s: PNode, a, b: PNode): bool = 
   # checks if some element of a..b is in the set s
-  if s.kind != nkCurly: InternalError(s.info, "SomeInSet")
+  if s.kind != nkCurly:
+    InternalError(s.info, "SomeInSet")
+    return false
   for i in countup(0, sonsLen(s) - 1): 
     if s.sons[i].kind == nkRange: 
       if leValue(s.sons[i].sons[0], b) and leValue(b, s.sons[i].sons[1]) or
@@ -164,7 +168,9 @@ proc cardSet(s: PNode): BiggestInt =
       Inc(result)
   
 proc SetHasRange(s: PNode): bool = 
-  if s.kind != nkCurly: InternalError(s.info, "SetHasRange")
+  if s.kind != nkCurly:
+    InternalError(s.info, "SetHasRange")
+    return false
   for i in countup(0, sonsLen(s) - 1): 
     if s.sons[i].kind == nkRange: 
       return true