diff options
author | Araq <rumpf_a@web.de> | 2012-11-18 01:36:20 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-11-18 01:36:20 +0100 |
commit | 3c0a6a89629884b652bf351cb0cee5c94548effc (patch) | |
tree | f9053489e93a46e47701a8218d7cc9bd4b92b97f /compiler/sempass2.nim | |
parent | 7f6633a06feeac8d6bd1eb1e6d8e841591326618 (diff) | |
download | Nim-3c0a6a89629884b652bf351cb0cee5c94548effc.tar.gz |
'assert' hides EAssertionFailsure; stdlib makes use of 'tags'
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r-- | compiler/sempass2.nim | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 59ae26385..c3e2ce8bc 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -102,7 +102,8 @@ proc addEffect(a: PEffects, e: PNode, useLineInfo=true) = throws(a.exc, e) proc mergeEffects(a: PEffects, b: PNode, useLineInfo: bool) = - for effect in items(b): addEffect(a, effect, useLineInfo) + if not b.isNil: + for effect in items(b): addEffect(a, effect, useLineInfo) proc addTag(a: PEffects, e: PNode, useLineInfo=true) = var aa = a.tags @@ -113,7 +114,8 @@ proc addTag(a: PEffects, e: PNode, useLineInfo=true) = throws(a.tags, e) proc mergeTags(a: PEffects, b: PNode, useLineInfo: bool) = - for effect in items(b): addTag(a, effect, useLineInfo) + if not b.isNil: + for effect in items(b): addTag(a, effect, useLineInfo) proc listEffects(a: PEffects) = for e in items(a.exc): Message(e.info, hintUser, typeToString(e.typ)) @@ -125,7 +127,7 @@ proc catches(tracked: PEffects, e: PType) = var i = tracked.bottom while i < L: # r supertype of e? - if inheritanceDiff(tracked.exc[i].excType, e) <= 0: + if safeInheritanceDiff(tracked.exc[i].excType, e) <= 0: tracked.exc.sons[i] = tracked.exc.sons[L-1] dec L else: @@ -272,7 +274,7 @@ proc checkRaisesSpec(spec, real: PNode, msg: string, hints: bool) = for r in items(real): block search: for s in 0 .. <spec.len: - if inheritanceDiff(r.excType, spec[s].typ) <= 0: + if safeInheritanceDiff(r.excType, spec[s].typ) <= 0: used.incl(s) break search # XXX call graph analysis would be nice here! @@ -341,6 +343,6 @@ proc trackProc*(s: PSym, body: PNode) = let tagsSpec = effectSpec(p, wTags) if not isNil(tagsSpec): checkRaisesSpec(tagsSpec, t.tags, "can have an unlisted effect: ", - hints=on) + hints=off) # after the check, use the formal spec: effects.sons[tagEffects] = tagsSpec |