diff options
author | Araq <rumpf_a@web.de> | 2011-05-01 20:11:55 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-05-01 20:11:55 +0200 |
commit | 6ff8752be53b7c0ad2c01615fdf1ab1bb619fb83 (patch) | |
tree | 6ad172b70b3b54063bc0dd6566a6c4ed0f5b0a99 /compiler/sem.nim | |
parent | 0d75723f919931c8523715dbd537d6f86d8ac3dd (diff) | |
download | Nim-6ff8752be53b7c0ad2c01615fdf1ab1bb619fb83.tar.gz |
cleaned up the tests; fixes #30; fixes #26
Diffstat (limited to 'compiler/sem.nim')
-rwxr-xr-x | compiler/sem.nim | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index 2b2d9506b..2e63ea2ef 100755 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -18,16 +18,6 @@ import proc semPass*(): TPass # implementation -proc considerAcc(n: PNode): PIdent = - var x = n - if x.kind == nkAccQuoted: x = x.sons[0] - case x.kind - of nkIdent: result = x.ident - of nkSym: result = x.sym.name - else: - GlobalError(n.info, errIdentifierExpected, renderTree(n)) - result = nil - proc isTopLevel(c: PContext): bool {.inline.} = result = c.tab.tos <= 2 @@ -35,7 +25,8 @@ proc newSymS(kind: TSymKind, n: PNode, c: PContext): PSym = result = newSym(kind, considerAcc(n), getCurrOwner()) result.info = n.info -proc semIdentVis(c: PContext, kind: TSymKind, n: PNode, allowed: TSymFlags): PSym +proc semIdentVis(c: PContext, kind: TSymKind, n: PNode, + allowed: TSymFlags): PSym # identifier with visability proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode, allowed: TSymFlags): PSym @@ -120,20 +111,13 @@ proc typeMismatch(n: PNode, formal, actual: PType) = proc fitNode(c: PContext, formal: PType, arg: PNode): PNode = result = IndexTypesMatch(c, formal, arg.typ, arg) - if result == nil: + if result == nil: #debug(arg) typeMismatch(arg, formal, arg.typ) proc forceBool(c: PContext, n: PNode): PNode = result = fitNode(c, getSysType(tyBool), n) if result == nil: result = n - when false: - result = t - if (t.Typ == nil) or - (skipTypes(t.Typ, {tyGenericInst, tyVar, tyOrdinal}).kind != tyBool): - var a = ConvertTo(c, getSysType(tyBool), t) - if a != nil: result = a - else: LocalError(t.Info, errExprMustBeBool) proc semConstBoolExpr(c: PContext, n: PNode): PNode = result = fitNode(c, getSysType(tyBool), semExprWithType(c, n)) |