diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/nimconf.nim | 2 | ||||
-rw-r--r-- | compiler/pretty.nim | 18 | ||||
-rw-r--r-- | compiler/semtypinst.nim | 4 | ||||
-rw-r--r-- | compiler/types.nim | 6 |
4 files changed, 13 insertions, 17 deletions
diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim index ae6487744..d7ce0d57f 100644 --- a/compiler/nimconf.nim +++ b/compiler/nimconf.nim @@ -49,7 +49,7 @@ proc parseExpr(L: var TLexer, tok: var TToken): bool = var b = parseAndExpr(L, tok) result = result or b -proc EvalppIf(L: var TLexer, tok: var TToken): bool = +proc evalppIf(L: var TLexer, tok: var TToken): bool = ppGetTok(L, tok) # skip 'if' or 'elif' result = parseExpr(L, tok) if tok.tokType == tkColon: ppGetTok(L, tok) diff --git a/compiler/pretty.nim b/compiler/pretty.nim index 2955193d0..095a132b3 100644 --- a/compiler/pretty.nim +++ b/compiler/pretty.nim @@ -273,17 +273,13 @@ proc check(c: PGen, n: PNode) = nkMacroDef, nkConverterDef: checkDef(c, n[namePos]) for i in namePos+1 .. <n.len: check(c, n.sons[i]) - of nkVarSection, nkLetSection: - for i in countup(0, sonsLen(n) - 1): - let a = n.sons[i] - if a.kind == nkCommentStmt: continue - if a.kind != nkIdentDefs and a.kind != nkVarTuple: - globalError(a.info, errGenerated, "invalid ast") - checkMinSonsLen(a, 3) - let L = len(a) - for j in countup(0, L-3): checkDef(c, a.sons[j]) - check(c, a.sons[L-2]) - check(c, a.sons[L-1]) + of nkIdentDefs, nkVarTuple: + let a = n + checkMinSonsLen(a, 3) + let L = len(a) + for j in countup(0, L-3): checkDef(c, a.sons[j]) + check(c, a.sons[L-2]) + check(c, a.sons[L-1]) of nkTypeSection, nkConstSection: for i in countup(0, sonsLen(n) - 1): let a = n.sons[i] diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index c872c39f3..d51c1de8c 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -47,11 +47,11 @@ proc searchInstTypes*(key: PType): PType = # types such as TChannel[empty]. Why? # See the notes for PActor in handleGenericInvokation return - block MatchType: + block matchType: for j in 1 .. high(key.sons): # XXX sameType is not really correct for nested generics? if not sameType(inst.sons[j], key.sons[j]): - break MatchType + break matchType return inst diff --git a/compiler/types.nim b/compiler/types.nim index be948246c..3d040fdd5 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -387,7 +387,7 @@ proc mutateType(t: PType, iter: TTypeMutator, closure: PObject): PType = var marker = InitIntSet() result = mutateTypeAux(marker, t, iter, closure) -proc ValueToString(a: PNode): string = +proc valueToString(a: PNode): string = case a.kind of nkCharLit..nkUInt64Lit: result = $(a.intVal) of nkFloatLit..nkFloat128Lit: result = $(a.floatVal) @@ -692,7 +692,7 @@ proc equalParams(a, b: PNode): TParamsEquality = result = paramsIncompatible # overloading by different # result types does not work -proc SameLiteral(x, y: PNode): bool = +proc sameLiteral(x, y: PNode): bool = if x.kind == y.kind: case x.kind of nkCharLit..nkInt64Lit: result = x.intVal == y.intVal @@ -700,7 +700,7 @@ proc SameLiteral(x, y: PNode): bool = of nkNilLit: result = true else: assert(false) -proc SameRanges(a, b: PNode): bool = +proc sameRanges(a, b: PNode): bool = result = SameLiteral(a.sons[0], b.sons[0]) and SameLiteral(a.sons[1], b.sons[1]) |