From 56045ad7ff06c8dc7e3b1c4ac9ae3cb083fae485 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 1 May 2013 14:48:40 +0200 Subject: [PATCH] bugfixes mostly JS related --- compiler/ccgtypes.nim | 11 ----------- compiler/jsgen.nim | 9 ++++++--- compiler/types.nim | 15 ++++++++++++++- lib/pure/pegs.nim | 8 +++++--- lib/pure/times.nim | 4 +++- lib/system/jssys.nim | 5 +++++ tests/manyloc/argument_parser/ex_wget.nimrod.cfg | 1 + .../manyloc/{keineschweine => nake}/nakefile.nim | 2 +- .../{keineschweine => nake}/nakefile.nimrod.cfg | 0 todo.txt | 2 ++ 10 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 tests/manyloc/argument_parser/ex_wget.nimrod.cfg rename tests/manyloc/{keineschweine => nake}/nakefile.nim (99%) rename tests/manyloc/{keineschweine => nake}/nakefile.nimrod.cfg (100%) diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index d37e79d6b1..6f54f7e2f8 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -137,17 +137,6 @@ proc mangleName(s: PSym): PRope = app(result, toRope(s.id)) s.loc.r = result -proc isCompileTimeOnly(t: PType): bool = - result = t.kind in {tyTypedesc, tyExpr} - -proc containsCompileTimeOnly(t: PType): bool = - if isCompileTimeOnly(t): return true - if t.sons != nil: - for i in 0 .. 1: app(r.res, ", ") - genArg(p, n.sons[i], r) + genArg(p, it, r) app(r.res, ")") r.kind = resExpr @@ -1128,7 +1131,7 @@ proc genMagic(p: PProc, n: PNode, r: var TCompRes) = # XXX: range checking? if not (optOverflowCheck in p.Options): binaryExpr(p, n, r, "", "$1 - $2") else: binaryExpr(p, n, r, "addInt", "addInt($1, $2)") - of mAppendStrCh: binaryExpr(p, n, r, "addChar", "$1 = addChar($1, $2)") + of mAppendStrCh: binaryExpr(p, n, r, "addChar", "addChar($1, $2)") of mAppendStrStr: if skipTypes(n.sons[1].typ, abstractVarRange).kind == tyCString: binaryExpr(p, n, r, "", "$1 += $2") diff --git a/compiler/types.nim b/compiler/types.nim index 5b1da74d47..6f47a7f2dc 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -486,7 +486,9 @@ proc TypeToString(typ: PType, prefer: TPreferedDesc = preferName): string = of tyPtr, tyRef, tyVar, tyMutable, tyConst: result = typeToStr[t.kind] & typeToString(t.sons[0]) of tyRange: - result = "range " & rangeToStr(t.n) & "(" & typeToString(t.sons[0]) & ")" + result = "range " & rangeToStr(t.n) + if prefer != preferExported: + result.add("(" & typeToString(t.sons[0]) & ")") of tyProc: result = if tfIterator in t.flags: "iterator (" else: "proc (" for i in countup(1, sonsLen(t) - 1): @@ -1281,3 +1283,14 @@ proc compatibleEffects*(formal, actual: PType): bool = result = compatibleEffectsAux(st, real.sons[tagEffects]) if not result: return result = true + +proc isCompileTimeOnly*(t: PType): bool {.inline.} = + result = t.kind in {tyTypedesc, tyExpr} + +proc containsCompileTimeOnly*(t: PType): bool = + if isCompileTimeOnly(t): return true + if t.sons != nil: + for i in 0 ..