From ddb70d33f814619333e475975c6dbe6e39e5d035 Mon Sep 17 00:00:00 2001 From: Wh1teDuke Date: Mon, 19 Sep 2016 16:24:15 +0200 Subject: [PATCH 01/15] Add processSingleTest, remove file arg from processCategory --- tests/testament/categories.nim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index 3ed2f2196..5e18587f0 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -375,8 +375,14 @@ proc `&.?`(a, b: string): string = proc `&?.`(a, b: string): string = # candidate for the stdlib? result = if a.endswith(b): a else: a & b + +proc processSingleTest(r: var TResults, cat: Category, options, test: string) = + let test = "tests" & DirSep &.? cat.string / test -proc processCategory(r: var TResults, cat: Category, options: string, fileGlob: string = "t*.nim") = + if existsFile(test): testSpec r, makeTest(test, options, cat) + else: echo "[Warning] - ", test, " test does not exist" + +proc processCategory(r: var TResults, cat: Category, options: string) = case cat.string.normalize of "rodfiles": when false: compileRodFiles(r, cat, options) @@ -417,5 +423,5 @@ proc processCategory(r: var TResults, cat: Category, options: string, fileGlob: # We can't test it because it depends on a third party. discard # TODO: Move untestable tests to someplace else, i.e. nimble repo. else: - for name in os.walkFiles("tests" & DirSep &.? cat.string / fileGlob): + for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"): testSpec r, makeTest(name, options, cat) From 248b5c0468bc0fbbf2f4963b7980a64ed3060c43 Mon Sep 17 00:00:00 2001 From: Wh1teDuke Date: Mon, 19 Sep 2016 16:25:39 +0200 Subject: [PATCH 02/15] Run Option: use now processSingleTest --- tests/testament/tester.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index 74ac58927..2734742f4 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -445,7 +445,7 @@ proc main() = let (dir, file) = splitPath(p.key.string) let (_, subdir) = splitPath(dir) var cat = Category(subdir) - processCategory(r, cat, p.cmdLineRest.string, file) + processSingleTest(r, cat, p.cmdLineRest.string, file) of "html": var commit = 0 discard parseInt(p.cmdLineRest.string, commit) From 693b2b0f5d809570d684fc2a93c9f25ac7f6467d Mon Sep 17 00:00:00 2001 From: Andrea Ferretti Date: Wed, 21 Sep 2016 17:35:45 +0200 Subject: [PATCH 03/15] Added js console object --- lib/js/jsconsole.nim | 32 ++++++++++++++++++++++++++++++++ tests/js/tconsole.nim | 9 +++++++++ 2 files changed, 41 insertions(+) create mode 100644 lib/js/jsconsole.nim create mode 100644 tests/js/tconsole.nim diff --git a/lib/js/jsconsole.nim b/lib/js/jsconsole.nim new file mode 100644 index 000000000..7bdc8922e --- /dev/null +++ b/lib/js/jsconsole.nim @@ -0,0 +1,32 @@ +# +# +# Nim's Runtime Library +# (c) Copyright 2012 Andreas Rumpf +# +# See the file "copying.txt", included in this +# distribution, for details about the copyright. +# + +## Wrapper for the `console` object for the `JavaScript backend +## `_. + +when not defined(js) and not defined(Nimdoc): + {.error: "This module only works on the JavaScript platform".} + +type Console* {.importc.} = ref object of RootObj + +{.push importcpp .} + +proc log*[A](console: Console, a: A) +proc debug*[A](console: Console, a: A) +proc info*[A](console: Console, a: A) +proc error*[A](console: Console, a: A) + +{.pop.} + +proc log*(console: Console, a: string) = console.log(cstring(a)) +proc debug*(console: Console, a: string) = console.log(cstring(a)) +proc info*(console: Console, a: string) = console.log(cstring(a)) +proc error*(console: Console, a: string) = console.log(cstring(a)) + +var console* {.importc, nodecl.}: Console \ No newline at end of file diff --git a/tests/js/tconsole.nim b/tests/js/tconsole.nim new file mode 100644 index 000000000..1898bfd5e --- /dev/null +++ b/tests/js/tconsole.nim @@ -0,0 +1,9 @@ +discard """ + output: "Hello, console" +""" + +# This file tests the JavaScript console + +import jsconsole + +console.log("Hello, console") \ No newline at end of file From 25ee55adfc94f3a71a4764f7e8ee86b2a97bccf9 Mon Sep 17 00:00:00 2001 From: Andrea Ferretti Date: Thu, 22 Sep 2016 11:39:24 +0200 Subject: [PATCH 04/15] Update to allow varargs in js console logging --- lib/js/jsconsole.nim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/js/jsconsole.nim b/lib/js/jsconsole.nim index 7bdc8922e..2e3eda8b8 100644 --- a/lib/js/jsconsole.nim +++ b/lib/js/jsconsole.nim @@ -15,6 +15,14 @@ when not defined(js) and not defined(Nimdoc): type Console* {.importc.} = ref object of RootObj +proc convertToConsoleLoggable*[T](v: T): RootRef {.importcpp: "#".} +template convertToConsoleLoggable*(v: string): RootRef = cast[RootRef](cstring(v)) + +proc log*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.log(#)".} +proc debug*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.debug(#)".} +proc info*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.info(#)".} +proc error*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.error(#)".} + {.push importcpp .} proc log*[A](console: Console, a: A) @@ -23,7 +31,6 @@ proc info*[A](console: Console, a: A) proc error*[A](console: Console, a: A) {.pop.} - proc log*(console: Console, a: string) = console.log(cstring(a)) proc debug*(console: Console, a: string) = console.log(cstring(a)) proc info*(console: Console, a: string) = console.log(cstring(a)) From 15f7094fde2a5677b6566dfa1a883237cac676ec Mon Sep 17 00:00:00 2001 From: Andrea Ferretti Date: Thu, 22 Sep 2016 12:07:36 +0200 Subject: [PATCH 05/15] Added a dump macro for debugging --- lib/pure/future.nim | 21 +++++++++++++++++++++ tests/macros/tdump.nim | 13 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/macros/tdump.nim diff --git a/lib/pure/future.nim b/lib/pure/future.nim index 67975cfcb..2a6d29933 100644 --- a/lib/pure/future.nim +++ b/lib/pure/future.nim @@ -177,3 +177,24 @@ macro `[]`*(lc: ListComprehension, comp, typ: untyped): untyped = newIdentNode("@"), newNimNode(nnkBracket))), result)))) + + +macro dump*(x: typed): untyped = + ## Dumps the content of an expression, useful for debugging. + ## It accepts any expression and prints a textual representation + ## of the tree representing the expression - as it would appear in + ## source code - together with the value of the expression. + ## + ## As an example, + ## + ## .. code-block:: nim + ## let + ## x = 10 + ## y = 20 + ## dump(x + y) + ## + ## will print ``x + y = 30``. + let s = x.toStrLit + let r = quote do: + debugEcho `s`, " = ", `x` + return r \ No newline at end of file diff --git a/tests/macros/tdump.nim b/tests/macros/tdump.nim new file mode 100644 index 000000000..e4c14dc6b --- /dev/null +++ b/tests/macros/tdump.nim @@ -0,0 +1,13 @@ +discard """ + output: '''x = 10 +x + y = 30 +''' +""" + +import future + +let + x = 10 + y = 20 +dump x +dump(x + y) \ No newline at end of file From 235fc29834bf820e720bbbfdd3fb5f0c684d53ec Mon Sep 17 00:00:00 2001 From: Andrea Ferretti Date: Thu, 22 Sep 2016 12:26:51 +0200 Subject: [PATCH 06/15] Added expandMacros macro --- lib/core/macros.nim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 19452b4a8..af346e2b3 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -890,6 +890,30 @@ proc boolVal*(n: NimNode): bool {.compileTime, noSideEffect.} = if n.kind == nnkIntLit: n.intVal != 0 else: n == bindSym"true" # hacky solution for now +macro expandMacros*(body: stmt): untyped = + ## Expands one level of macro - useful for debugging. + ## Can be used to inspect what happens when a macro call is expanded, + ## without altering its result. + ## + ## For instance, + ## + ## .. code-block:: nim + ## import future, macros + ## + ## let + ## x = 10 + ## y = 20 + ## expandMacros: + ## dump(x + y) + ## + ## will actually dump `x + y`, but at the same time will print at + ## compile time the expansion of the ``dump`` macro, which in this + ## case is ``debugEcho ["x + y", " = ", x + y]``. + template inner(x: untyped): untyped = x + + result = getAst(inner(body)) + echo result.toStrLit + when not defined(booting): template emit*(e: static[string]): untyped {.deprecated.} = ## accepts a single string argument and treats it as nim code From 61755945d2267f0406973d6359ef7a4fe4a79731 Mon Sep 17 00:00:00 2001 From: Pavel Roschin Date: Thu, 22 Sep 2016 00:13:01 +0300 Subject: [PATCH 07/15] Enable JIT in PCRE to improve regular expressions performance --- lib/impure/nre.nim | 7 ++++++- lib/impure/re.nim | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/impure/nre.nim b/lib/impure/nre.nim index 76a0f3db6..5d62cb0b9 100644 --- a/lib/impure/nre.nim +++ b/lib/impure/nre.nim @@ -432,7 +432,12 @@ proc initRegex(pattern: string, flags: int, study = true): Regex = if study: # XXX investigate JIT - result.pcreExtra = pcre.study(result.pcreObj, 0x0, addr errorMsg) + var options: cint = 0 + var hasJit: cint + if pcre.config(pcre.CONFIG_JIT, addr hasJit) == 0: + if hasJit == 1'i32: + options = pcre.STUDY_JIT_COMPILE + result.pcreExtra = pcre.study(result.pcreObj, options, addr errorMsg) if errorMsg != nil: raise StudyError(msg: $errorMsg) diff --git a/lib/impure/re.nim b/lib/impure/re.nim index bf397550a..f73f9547a 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -87,7 +87,12 @@ proc re*(s: string, flags = {reExtended, reStudy}): Regex = result.h = rawCompile(s, cast[cint](flags - {reStudy})) if reStudy in flags: var msg: cstring - result.e = pcre.study(result.h, 0, addr msg) + var options: cint = 0 + var hasJit: cint + if pcre.config(pcre.CONFIG_JIT, addr hasJit) == 0: + if hasJit == 1'i32: + options = pcre.STUDY_JIT_COMPILE + result.e = pcre.study(result.h, options, addr msg) if not isNil(msg): raiseInvalidRegex($msg) proc matchOrFind(s: string, pattern: Regex, matches: var openArray[string], @@ -214,7 +219,7 @@ proc find*(s: string, pattern: Regex, start = 0): int = var rtarray = initRtArray[cint](3) rawMatches = rtarray.getRawData - res = pcre.exec(pattern.h, nil, s, len(s).cint, start.cint, 0'i32, + res = pcre.exec(pattern.h, pattern.e, s, len(s).cint, start.cint, 0'i32, cast[ptr cint](rawMatches), 3) if res < 0'i32: return res return rawMatches[0] From a9e5f5d7e226302135c6b68af274190058993759 Mon Sep 17 00:00:00 2001 From: Andrea Ferretti Date: Sun, 25 Sep 2016 15:53:32 +0200 Subject: [PATCH 08/15] Removed use of stmt --- lib/core/macros.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/macros.nim b/lib/core/macros.nim index af346e2b3..1a26d5522 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -890,7 +890,7 @@ proc boolVal*(n: NimNode): bool {.compileTime, noSideEffect.} = if n.kind == nnkIntLit: n.intVal != 0 else: n == bindSym"true" # hacky solution for now -macro expandMacros*(body: stmt): untyped = +macro expandMacros*(body: typed): untyped = ## Expands one level of macro - useful for debugging. ## Can be used to inspect what happens when a macro call is expanded, ## without altering its result. From 77ba8cb8bbbf1df845e407714024bccd8434293d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Fri, 30 Sep 2016 19:43:38 +0200 Subject: [PATCH 09/15] Added icons support for Visual Studio compiler --- compiler/nim.nim | 5 +++++ icons/koch-amd64-windows-vcc.res | Bin 0 -> 5572 bytes icons/koch-i386-windows-vcc.res | Bin 0 -> 5572 bytes icons/nim-amd64-windows-vcc.res | Bin 0 -> 30548 bytes icons/nim-i386-windows-vcc.res | Bin 0 -> 30548 bytes koch.nim | 5 +++++ 6 files changed, 10 insertions(+) create mode 100644 icons/koch-amd64-windows-vcc.res create mode 100644 icons/koch-i386-windows-vcc.res create mode 100644 icons/nim-amd64-windows-vcc.res create mode 100644 icons/nim-i386-windows-vcc.res diff --git a/compiler/nim.nim b/compiler/nim.nim index a58afd593..0afefa853 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -13,6 +13,11 @@ when defined(gcc) and defined(windows): else: {.link: "icons/nim_icon.o".} +when defined(amd64) and defined(windows) and defined(vcc): + {.link: "icons/nim-amd64-windows-vcc.res" .} +when defined(i386) and defined(windows) and defined(vcc): + {.link: "icons/nim-i386-windows-vcc.res" .} + import commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes, extccomp, strutils, os, osproc, platform, main, parseopt, service, diff --git a/icons/koch-amd64-windows-vcc.res b/icons/koch-amd64-windows-vcc.res new file mode 100644 index 0000000000000000000000000000000000000000..90d7d1f7ac5b515f7be044293c34654c39e06f0f GIT binary patch literal 5572 zcmeHLYbfPg6#p9{YHr6Td~&=ZQo~3-F?n@wbWsY)7ZS;Ml~;&i@?kV;ibC@Kph#2W zlSg@#M?{LD%rJ~8@_xV9{D0g0&+PMeIOp7Z#_iUu+W)=xT5GSh{(G;z_Fh{M1VJel zqT3=i)gakKq8p1mMvSIVn2Xq3a1kqoSd?NhVqZacp`wb&A3z3zo0}VIXlS6y%1SCJ zDWRgGA}T8@qgSt9QE_oGt3ewW7$ESE1_*47<-Q&SVw*Vj{N zX({F9>ch`qdrC?Q`#0cwdU_~1IhkOe#K#)qCo3z9zJC2m)6>(Gl$1on!^0}Qb#-;j zmbkb$+TY)2_`$(JN=!_o>+5UQpPikhfPesMZEdB4g9AydS`FU9!a}wOnwy(xb#;~X zfqV1j4PmV%xH>=m5nZGxqkr8l1{tLoONbDMp0KDQk3*op5Q`LtN)VW2AldZ0{y77D z3|d%NAo#0~j}JLHIgvu4AR{9qvaqlq6B83MH8mwOGc$2L1+urdCpR}YijIz^zP>)S zHRomi)O3Ff@e{KB{r#z;qJqiW*w~<*ogKoy;o7c!}I*w+F@Z~>>Sa?rwje$${f>tzX;!%IUxL8+QHW^Q*1@f17{obA9%Uq5nT5 zB!ng=CbWrtkk0Q>#GlE@$p`sCJUTj}pr9ZYuW^3wy{`T!#rfYe5S)~r=2lB(m0_2hW z|MKm}vH|%qa@y|hZVC<#ek`>rJ)b{+X1;-Yi6);=G5(^){QNvcL_{#@(){1&GjbDj z<&%%&`*?SVkB?XBUtC;dZRAlrK$oPiqoadjVq$o*# zXYV$+59a3PvYZ0)c#!4nK;ZY&3hj<*?4PfsQXXE0<> zO-;$!wf13$ru(zCwKbu*ySo$KL*&ra)x~sw`t(Uo(yM=de$M0|ze8?>0-MUq%b6T0 zrXpYS_V%Xd&!00oazW%jh60>tcw4~U(FDk`Fi-GjUEp|g6?XooU@vNaCKjSUgb*Q2 q2oU}h{t~}o!rv;po^kK1c+GesD8!cxylUVzR;-n`J-mtFCFDEoWIUMw literal 0 HcmV?d00001 diff --git a/icons/koch-i386-windows-vcc.res b/icons/koch-i386-windows-vcc.res new file mode 100644 index 0000000000000000000000000000000000000000..90d7d1f7ac5b515f7be044293c34654c39e06f0f GIT binary patch literal 5572 zcmeHLYbfPg6#p9{YHr6Td~&=ZQo~3-F?n@wbWsY)7ZS;Ml~;&i@?kV;ibC@Kph#2W zlSg@#M?{LD%rJ~8@_xV9{D0g0&+PMeIOp7Z#_iUu+W)=xT5GSh{(G;z_Fh{M1VJel zqT3=i)gakKq8p1mMvSIVn2Xq3a1kqoSd?NhVqZacp`wb&A3z3zo0}VIXlS6y%1SCJ zDWRgGA}T8@qgSt9QE_oGt3ewW7$ESE1_*47<-Q&SVw*Vj{N zX({F9>ch`qdrC?Q`#0cwdU_~1IhkOe#K#)qCo3z9zJC2m)6>(Gl$1on!^0}Qb#-;j zmbkb$+TY)2_`$(JN=!_o>+5UQpPikhfPesMZEdB4g9AydS`FU9!a}wOnwy(xb#;~X zfqV1j4PmV%xH>=m5nZGxqkr8l1{tLoONbDMp0KDQk3*op5Q`LtN)VW2AldZ0{y77D z3|d%NAo#0~j}JLHIgvu4AR{9qvaqlq6B83MH8mwOGc$2L1+urdCpR}YijIz^zP>)S zHRomi)O3Ff@e{KB{r#z;qJqiW*w~<*ogKoy;o7c!}I*w+F@Z~>>Sa?rwje$${f>tzX;!%IUxL8+QHW^Q*1@f17{obA9%Uq5nT5 zB!ng=CbWrtkk0Q>#GlE@$p`sCJUTj}pr9ZYuW^3wy{`T!#rfYe5S)~r=2lB(m0_2hW z|MKm}vH|%qa@y|hZVC<#ek`>rJ)b{+X1;-Yi6);=G5(^){QNvcL_{#@(){1&GjbDj z<&%%&`*?SVkB?XBUtC;dZRAlrK$oPiqoadjVq$o*# zXYV$+59a3PvYZ0)c#!4nK;ZY&3hj<*?4PfsQXXE0<> zO-;$!wf13$ru(zCwKbu*ySo$KL*&ra)x~sw`t(Uo(yM=de$M0|ze8?>0-MUq%b6T0 zrXpYS_V%Xd&!00oazW%jh60>tcw4~U(FDk`Fi-GjUEp|g6?XooU@vNaCKjSUgb*Q2 q2oU}h{t~}o!rv;po^kK1c+GesD8!cxylUVzR;-n`J-mtFCFDEoWIUMw literal 0 HcmV?d00001 diff --git a/icons/nim-amd64-windows-vcc.res b/icons/nim-amd64-windows-vcc.res new file mode 100644 index 0000000000000000000000000000000000000000..b2d8fc9eb413771f524e8562847936942eed0af1 GIT binary patch literal 30548 zcmeHQ2|!HS|3CLOqbaIslf6mNLYwSGqtHr=N|qK`B9tO2GGmQwNo8$$D(VrDq*4tY z;St)Tr-dY~Q`&2q`#*Q4VV+-9-h03Q@BjbJ;mr4(^IgvO`#I;{d(L(51pojPm@$l- zVewCCmK={S1Z5Bok4zRJ@PrOqE;bSq9VH6uVkXA(tpUJg5I`CN$x5%dbpXf#llk*( zb`;l#i|n!~$jE+SLLuAz9t`#>DaDarrp>7}uv-3FRBge^!+WXZwI{nA6N=lCm-lom zmkSD~9I>-}OHHtEuPi9cklLcK=MIH*@4%eNsXb*%#s=#qCcUkEdzRVWe0G-3v!Gd3 z5#8OTTU{IGES&_5mrXswaRvnddP@R;%!z~w0G;C@_$L@J_d2ow|3DefP3xQZMN_}U3;teS{W_L&BN9@KP1giA^Ji2 z0k)Xx;=}I~5|pz3FcgV02yC;Gkng(cGC^d1N7agH4i2MPDg?`J58Jc{w$+pGQTLYx zzNrFP(?jFh$qMzREU9Y&8NVa_qBja)m~d zsn!8mr(|j?Ipan zVJ6ySgaQcV>0oi_dvE2WxM-I1VzL1sF=)utlP(e{$RciuAeD~{yVF#L*q9DKud6_h zwH{^w9t|zGT-N2}MIobyrUw)skoXuwahkyRg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~}gnKV;5{3eB_s7S_ zYeeBM{C@ONxGO`6_{tK6#yJ$Paa!<3yanJpHvk}?Lpe1rqjw+B2fvrYQSVE?4?fzv zUF2HhXmWeu`Uf50bl+R!u(;-XZT0ebHJr!458%beF#?y(-|}I2y#aD0xcpvW4*3%s z+Q!l0UwrfY=jsrkgMVUkH2CascPe}hg5rM|0^D^9_ZKdEBpLw_=H=!wV_d5;=QcAl z=XUe*3;A8XWm&s>Ua;gl@r?hg1O6`%kr<7|Z)>3C_3%ibKuoyn817;5?K%d(k$}q# zXdROZ7lXZP8NnI`f+k1;1pYe_;9GUz0Kl~cTr?2iQUb0qICVsbQx`%wbs-=G{}Qd2 Date: Thu, 6 Oct 2016 10:54:52 +0200 Subject: [PATCH 10/15] Updated js console logging to avoid wrapping into array --- lib/js/jsconsole.nim | 21 ++++----------------- tests/js/tconsole.nim | 8 ++++++-- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/lib/js/jsconsole.nim b/lib/js/jsconsole.nim index 2e3eda8b8..cd1bd8d2a 100644 --- a/lib/js/jsconsole.nim +++ b/lib/js/jsconsole.nim @@ -18,22 +18,9 @@ type Console* {.importc.} = ref object of RootObj proc convertToConsoleLoggable*[T](v: T): RootRef {.importcpp: "#".} template convertToConsoleLoggable*(v: string): RootRef = cast[RootRef](cstring(v)) -proc log*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.log(#)".} -proc debug*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.debug(#)".} -proc info*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.info(#)".} -proc error*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.error(#)".} - -{.push importcpp .} - -proc log*[A](console: Console, a: A) -proc debug*[A](console: Console, a: A) -proc info*[A](console: Console, a: A) -proc error*[A](console: Console, a: A) - -{.pop.} -proc log*(console: Console, a: string) = console.log(cstring(a)) -proc debug*(console: Console, a: string) = console.log(cstring(a)) -proc info*(console: Console, a: string) = console.log(cstring(a)) -proc error*(console: Console, a: string) = console.log(cstring(a)) +proc log*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.log.apply(null, #)".} +proc debug*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.debug.apply(null, #)".} +proc info*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.info.apply(null, #)".} +proc error*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.error.apply(null, #)".} var console* {.importc, nodecl.}: Console \ No newline at end of file diff --git a/tests/js/tconsole.nim b/tests/js/tconsole.nim index 1898bfd5e..f6da71c20 100644 --- a/tests/js/tconsole.nim +++ b/tests/js/tconsole.nim @@ -1,9 +1,13 @@ discard """ - output: "Hello, console" + output: '''Hello, console +1 2 3 +1 'hi' 1.1''' """ # This file tests the JavaScript console import jsconsole -console.log("Hello, console") \ No newline at end of file +console.log("Hello, console") +console.log(1, 2, 3) +console.log(1, "hi", 1.1) \ No newline at end of file From f0308e9bcf79990be85edc16592d0bfbdfc338bd Mon Sep 17 00:00:00 2001 From: Andrea Ferretti Date: Thu, 6 Oct 2016 11:35:29 +0200 Subject: [PATCH 11/15] New version of js console using macros - avoid the use of .apply method --- lib/js/jsconsole.nim | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/js/jsconsole.nim b/lib/js/jsconsole.nim index cd1bd8d2a..d9ced95f0 100644 --- a/lib/js/jsconsole.nim +++ b/lib/js/jsconsole.nim @@ -13,14 +13,32 @@ when not defined(js) and not defined(Nimdoc): {.error: "This module only works on the JavaScript platform".} +import macros + type Console* {.importc.} = ref object of RootObj proc convertToConsoleLoggable*[T](v: T): RootRef {.importcpp: "#".} template convertToConsoleLoggable*(v: string): RootRef = cast[RootRef](cstring(v)) -proc log*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.log.apply(null, #)".} -proc debug*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.debug.apply(null, #)".} -proc info*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.info.apply(null, #)".} -proc error*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]) {.importcpp: "#.error.apply(null, #)".} +proc logImpl(console: Console) {.importcpp: "log", varargs.} +proc debugImpl(console: Console) {.importcpp: "debug", varargs.} +proc infoImpl(console: Console) {.importcpp: "info", varargs.} +proc errorImpl(console: Console) {.importcpp: "error", varargs.} + +proc makeConsoleCall(console: NimNode, procName: NimNode, args: NimNode): NimNode = + result = newCall(procName, console) + for c in args: result.add(c) + +macro log*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]): untyped = + makeConsoleCall(console, bindSym "logImpl", args) + +macro debug*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]): untyped = + makeConsoleCall(console, bindSym "debugImpl", args) + +macro info*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]): untyped = + makeConsoleCall(console, bindSym "infoImpl", args) + +macro error*(console: Console, args: varargs[RootRef, convertToConsoleLoggable]): untyped = + makeConsoleCall(console, bindSym "errorImpl", args) var console* {.importc, nodecl.}: Console \ No newline at end of file From dbef9f97c2efe38b9cb39130567f56df907785d3 Mon Sep 17 00:00:00 2001 From: Pavel Roschin Date: Mon, 10 Oct 2016 02:21:20 +0300 Subject: [PATCH 12/15] Remove TODO for PCRE JIT --- lib/impure/nre.nim | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/impure/nre.nim b/lib/impure/nre.nim index 5d62cb0b9..594c8aba8 100644 --- a/lib/impure/nre.nim +++ b/lib/impure/nre.nim @@ -431,7 +431,6 @@ proc initRegex(pattern: string, flags: int, study = true): Regex = raise SyntaxError(msg: $errorMsg, pos: errOffset, pattern: pattern) if study: - # XXX investigate JIT var options: cint = 0 var hasJit: cint if pcre.config(pcre.CONFIG_JIT, addr hasJit) == 0: From f488ed973d5eff91f555182f8d2be664085a0dc8 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 24 Oct 2016 23:11:38 +0800 Subject: [PATCH 13/15] clean up tyBigNum remnants --- compiler/ast.nim | 8 ++++++-- compiler/ccgutils.nim | 4 ++-- compiler/jsgen.nim | 7 +++---- compiler/semasgn.nim | 4 ++-- compiler/types.nim | 11 +++++------ compiler/vmdeps.nim | 3 +-- lib/core/macros.nim | 4 ++-- lib/system/hti.nim | 1 - 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index 2426dcc02..791639980 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -317,6 +317,10 @@ type TTypeKind* = enum # order is important! # Don't forget to change hti.nim if you make a change here # XXX put this into an include file to avoid this issue! + # several types are no longer used (guess which), but a + # spot in the sequence is kept for backwards compatibility + # (apparently something with bootstrapping) + # if you need to add a type, they can apparently be reused tyNone, tyBool, tyChar, tyEmpty, tyArrayConstr, tyNil, tyExpr, tyStmt, tyTypeDesc, tyGenericInvocation, # ``T[a, b]`` for types to invoke @@ -345,9 +349,9 @@ type tyInt, tyInt8, tyInt16, tyInt32, tyInt64, # signed integers tyFloat, tyFloat32, tyFloat64, tyFloat128, tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64, - tyBigNum, + tyUnused0, tyConst, tyMutable, tyVarargs, - tyUnused # kept for enum ordinal compatibility + tyUnused tyProxy # used as errornous type (for idetools) tyBuiltInTypeClass #\ diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim index 898c00f73..56ec72d02 100644 --- a/compiler/ccgutils.nim +++ b/compiler/ccgutils.nim @@ -93,7 +93,7 @@ proc getUniqueType*(key: PType): PType = # produced instead of ``NI``. result = key of tyEmpty, tyNil, tyExpr, tyStmt, tyPointer, tyString, - tyCString, tyNone, tyBigNum, tyVoid: + tyCString, tyNone, tyVoid: result = gCanonicalTypes[k] if result == nil: gCanonicalTypes[k] = key @@ -153,7 +153,7 @@ proc getUniqueType*(key: PType): PType = else: # ugh, we need the canon here: result = slowSearch(key, k) - of tyUnused: internalError("getUniqueType") + of tyUnused, tyUnused0: internalError("getUniqueType") proc tableGetType*(tab: TIdTable, key: PType): RootRef = # returns nil if we need to declare this type diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 6b95014f1..ed6f54ae3 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -138,7 +138,7 @@ proc declareGlobal(p: PProc; id: int; r: Rope) = const MappedToObject = {tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray, - tySet, tyBigNum, tyVarargs} + tySet, tyVarargs} proc mapType(typ: PType): TJSTypeKind = let t = skipTypes(typ, abstractInst) @@ -158,8 +158,7 @@ proc mapType(typ: PType): TJSTypeKind = of tyFloat..tyFloat128: result = etyFloat of tySet: result = etyObject # map a set to a table of tyString, tySequence: result = etySeq - of tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray, tyBigNum, - tyVarargs: + of tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray, tyVarargs: result = etyObject of tyNil: result = etyNull of tyGenericInst, tyGenericParam, tyGenericBody, tyGenericInvocation, @@ -171,7 +170,7 @@ proc mapType(typ: PType): TJSTypeKind = else: result = etyNone of tyProc: result = etyProc of tyCString: result = etyString - of tyUnused: internalError("mapType") + of tyUnused, tyUnused0: internalError("mapType") proc mapType(p: PProc; typ: PType): TJSTypeKind = if p.target == targetPHP: result = etyObject diff --git a/compiler/semasgn.nim b/compiler/semasgn.nim index 64a501e25..e8338ce2d 100644 --- a/compiler/semasgn.nim +++ b/compiler/semasgn.nim @@ -224,12 +224,12 @@ proc liftBodyAux(c: var TLiftCtx; t: PType; body, x, y: PNode) = of tyFromExpr, tyProxy, tyBuiltInTypeClass, tyUserTypeClass, tyUserTypeClassInst, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything, tyMutable, tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt, - tyTypeDesc, tyGenericInvocation, tyBigNum, tyConst, tyForward: + tyTypeDesc, tyGenericInvocation, tyConst, tyForward: internalError(c.info, "assignment requested for type: " & typeToString(t)) of tyOrdinal, tyRange, tyGenericInst, tyFieldAccessor, tyStatic, tyVar: liftBodyAux(c, lastSon(t), body, x, y) - of tyUnused: internalError("liftBodyAux") + of tyUnused, tyUnused0: internalError("liftBodyAux") proc newProcType(info: TLineInfo; owner: PSym): PType = result = newType(tyProc, owner) diff --git a/compiler/types.nim b/compiler/types.nim index d7651aad2..b3298b206 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -925,7 +925,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = case a.kind of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString, - tyInt..tyBigNum, tyStmt, tyExpr, tyVoid: + tyInt..tyUInt64, tyStmt, tyExpr, tyVoid: result = sameFlags(a, b) of tyStatic, tyFromExpr: result = exprStructuralEquivalent(a.n, b.n) and sameFlags(a, b) @@ -980,7 +980,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = sameValue(a.n.sons[1], b.n.sons[1]) of tyGenericInst: discard of tyNone: result = false - of tyUnused: internalError("sameFlags") + of tyUnused, tyUnused0: internalError("sameFlags") proc sameBackendType*(x, y: PType): bool = var c = initSameTypeClosure() @@ -1121,7 +1121,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind, result = t of tyNil: if kind != skConst: result = t - of tyString, tyBool, tyChar, tyEnum, tyInt..tyBigNum, tyCString, tyPointer: + of tyString, tyBool, tyChar, tyEnum, tyInt..tyUInt64, tyCString, tyPointer: result = nil of tyOrdinal: if kind != skParam: result = t @@ -1161,7 +1161,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind, # for now same as error node; we say it's a valid type as it should # prevent cascading errors: result = nil - of tyUnused: internalError("typeAllowedAux") + of tyUnused, tyUnused0: internalError("typeAllowedAux") proc typeAllowed*(t: PType, kind: TSymKind): PType = # returns 'nil' on success and otherwise the part of the type that is @@ -1252,8 +1252,7 @@ proc computeSizeAux(typ: PType, a: var BiggestInt): BiggestInt = if typ.callConv == ccClosure: result = 2 * ptrSize else: result = ptrSize a = ptrSize - of tyNil, tyCString, tyString, tySequence, tyPtr, tyRef, tyVar, tyOpenArray, - tyBigNum: + of tyNil, tyCString, tyString, tySequence, tyPtr, tyRef, tyVar, tyOpenArray: let base = typ.lastSon if base == typ or (base.kind == tyTuple and base.size==szIllegalRecursion): result = szIllegalRecursion diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index 61f56092c..becef1c5d 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -266,7 +266,6 @@ proc mapTypeToAstX(t: PType; info: TLineInfo; of tyUInt16: result = atomicType("uint16", mUint16) of tyUInt32: result = atomicType("uint32", mUint32) of tyUInt64: result = atomicType("uint64", mUint64) - of tyBigNum: result = atomicType("bignum", mNone) of tyConst: result = mapTypeToBracket("const", mNone, t, info) of tyMutable: result = mapTypeToBracket("mutable", mNone, t, info) of tyVarargs: result = mapTypeToBracket("varargs", mVarargs, t, info) @@ -291,7 +290,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo; result.add atomicType("static", mNone) if t.n != nil: result.add t.n.copyTree - of tyUnused: internalError("mapTypeToAstX") + of tyUnused, tyUnused0: internalError("mapTypeToAstX") proc opMapTypeToAst*(t: PType; info: TLineInfo): PNode = result = mapTypeToAstX(t, info, false, true) diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 292e8dd3c..34cb69d61 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -78,7 +78,7 @@ type nnkBreakState NimNodeKinds* = set[NimNodeKind] - NimTypeKind* = enum + NimTypeKind* = enum # some types are no longer used, see ast.nim ntyNone, ntyBool, ntyChar, ntyEmpty, ntyArrayConstr, ntyNil, ntyExpr, ntyStmt, ntyTypeDesc, ntyGenericInvocation, ntyGenericBody, ntyGenericInst, @@ -90,7 +90,7 @@ type ntyInt8, ntyInt16, ntyInt32, ntyInt64, ntyFloat, ntyFloat32, ntyFloat64, ntyFloat128, ntyUInt, ntyUInt8, ntyUInt16, ntyUInt32, ntyUInt64, - ntyBigNum, + ntyUnused0, ntyConst, ntyMutable, ntyVarargs, ntyUnused, ntyError, diff --git a/lib/system/hti.nim b/lib/system/hti.nim index 984f888cb..892a209df 100644 --- a/lib/system/hti.nim +++ b/lib/system/hti.nim @@ -62,7 +62,6 @@ type tyUInt16, tyUInt32, tyUInt64, - tyBigNum, TNimNodeKind = enum nkNone, nkSlot, nkList, nkCase TNimNode {.codegenType.} = object From b3de34548d5d518e3f4f14ae4fdf220578d68ec1 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 24 Oct 2016 23:19:46 +0800 Subject: [PATCH 14/15] clean up tyConst remnants --- compiler/ast.nim | 2 +- compiler/ccgtypes.nim | 4 ++-- compiler/ccgutils.nim | 4 ++-- compiler/jsgen.nim | 4 ++-- compiler/renderer.nim | 2 +- compiler/semasgn.nim | 4 ++-- compiler/semdestruct.nim | 2 +- compiler/types.nim | 42 ++++++++++++++++++---------------------- compiler/vmdeps.nim | 3 +-- lib/core/macros.nim | 2 +- 10 files changed, 32 insertions(+), 37 deletions(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index 791639980..943fdacc0 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -350,7 +350,7 @@ type tyFloat, tyFloat32, tyFloat64, tyFloat128, tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64, tyUnused0, - tyConst, tyMutable, tyVarargs, + tyUnused1, tyMutable, tyVarargs, tyUnused tyProxy # used as errornous type (for idetools) diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 6dcf80f2f..3ebd9bb27 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -122,7 +122,7 @@ proc mapType(typ: PType): TCTypeKind = of tyOpenArray, tyArrayConstr, tyArray, tyVarargs: result = ctArray of tyObject, tyTuple: result = ctStruct of tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal, - tyConst, tyMutable, tyTypeDesc: + tyMutable, tyTypeDesc: result = mapType(lastSon(typ)) of tyEnum: if firstOrd(typ) < 0: @@ -711,7 +711,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var IntSet): Rope = of 1, 2, 4, 8: addf(m.s[cfsTypes], "typedef NU$2 $1;$n", [result, rope(s*8)]) else: addf(m.s[cfsTypes], "typedef NU8 $1[$2];$n", [result, rope(getSize(t))]) - of tyGenericInst, tyDistinct, tyOrdinal, tyConst, tyMutable, tyTypeDesc: + of tyGenericInst, tyDistinct, tyOrdinal, tyMutable, tyTypeDesc: result = getTypeDescAux(m, lastSon(t), check) else: internalError("getTypeDescAux(" & $t.kind & ')') diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim index 56ec72d02..7a0d39101 100644 --- a/compiler/ccgutils.nim +++ b/compiler/ccgutils.nim @@ -106,7 +106,7 @@ proc getUniqueType*(key: PType): PType = of tyDistinct: if key.deepCopy != nil: result = key else: result = getUniqueType(lastSon(key)) - of tyGenericInst, tyOrdinal, tyMutable, tyConst, tyStatic: + of tyGenericInst, tyOrdinal, tyMutable, tyStatic: result = getUniqueType(lastSon(key)) #let obj = lastSon(key) #if obj.sym != nil and obj.sym.name.s == "TOption": @@ -153,7 +153,7 @@ proc getUniqueType*(key: PType): PType = else: # ugh, we need the canon here: result = slowSearch(key, k) - of tyUnused, tyUnused0: internalError("getUniqueType") + of tyUnused, tyUnused0, tyUnused1: internalError("getUniqueType") proc tableGetType*(tab: TIdTable, key: PType): RootRef = # returns nil if we need to declare this type diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index ed6f54ae3..ac1a79f2e 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -151,7 +151,7 @@ proc mapType(typ: PType): TJSTypeKind = of tyPointer: # treat a tyPointer like a typed pointer to an array of bytes result = etyBaseIndex - of tyRange, tyDistinct, tyOrdinal, tyConst, tyMutable, tyProxy: + of tyRange, tyDistinct, tyOrdinal, tyMutable, tyProxy: result = mapType(t.sons[0]) of tyInt..tyInt64, tyUInt..tyUInt64, tyEnum, tyChar: result = etyInt of tyBool: result = etyBool @@ -170,7 +170,7 @@ proc mapType(typ: PType): TJSTypeKind = else: result = etyNone of tyProc: result = etyProc of tyCString: result = etyString - of tyUnused, tyUnused0: internalError("mapType") + of tyUnused, tyUnused0, tyUnused1: internalError("mapType") proc mapType(p: PProc; typ: PType): TJSTypeKind = if p.target == targetPHP: result = etyObject diff --git a/compiler/renderer.nim b/compiler/renderer.nim index a116a8afe..a35096035 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -290,7 +290,7 @@ proc litAux(n: PNode, x: BiggestInt, size: int): string = proc skip(t: PType): PType = result = t while result.kind in {tyGenericInst, tyRange, tyVar, tyDistinct, tyOrdinal, - tyConst, tyMutable}: + tyMutable}: result = lastSon(result) if n.typ != nil and n.typ.skip.kind in {tyBool, tyEnum}: let enumfields = n.typ.skip.n diff --git a/compiler/semasgn.nim b/compiler/semasgn.nim index e8338ce2d..7748cf889 100644 --- a/compiler/semasgn.nim +++ b/compiler/semasgn.nim @@ -224,12 +224,12 @@ proc liftBodyAux(c: var TLiftCtx; t: PType; body, x, y: PNode) = of tyFromExpr, tyProxy, tyBuiltInTypeClass, tyUserTypeClass, tyUserTypeClassInst, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything, tyMutable, tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt, - tyTypeDesc, tyGenericInvocation, tyConst, tyForward: + tyTypeDesc, tyGenericInvocation, tyForward: internalError(c.info, "assignment requested for type: " & typeToString(t)) of tyOrdinal, tyRange, tyGenericInst, tyFieldAccessor, tyStatic, tyVar: liftBodyAux(c, lastSon(t), body, x, y) - of tyUnused, tyUnused0: internalError("liftBodyAux") + of tyUnused, tyUnused0, tyUnused1: internalError("liftBodyAux") proc newProcType(info: TLineInfo; owner: PSym): PType = result = newType(tyProc, owner) diff --git a/compiler/semdestruct.nim b/compiler/semdestruct.nim index 9ea581f3a..efaa2b7cf 100644 --- a/compiler/semdestruct.nim +++ b/compiler/semdestruct.nim @@ -124,7 +124,7 @@ proc instantiateDestructor(c: PContext, typ: PType): PType = # destructor that must be used for the varialbe. # The destructor is either user-defined or automatically # generated by the compiler in a member-wise fashion. - var t = skipTypes(typ, {tyConst, tyMutable}).skipGenericAlias + var t = skipTypes(typ, {tyMutable}).skipGenericAlias let typeHoldingUserDefinition = if t.kind == tyGenericInst: t.base else: t if typeHoldingUserDefinition.destructor != nil: diff --git a/compiler/types.nim b/compiler/types.nim index b3298b206..df4574a55 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -51,18 +51,17 @@ const # TODO: Remove tyTypeDesc from each abstractX and (where necessary) # replace with typedescX abstractPtrs* = {tyVar, tyPtr, tyRef, tyGenericInst, tyDistinct, tyOrdinal, - tyConst, tyMutable, tyTypeDesc} + tyMutable, tyTypeDesc} abstractVar* = {tyVar, tyGenericInst, tyDistinct, tyOrdinal, - tyConst, tyMutable, tyTypeDesc} + tyMutable, tyTypeDesc} abstractRange* = {tyGenericInst, tyRange, tyDistinct, tyOrdinal, - tyConst, tyMutable, tyTypeDesc} + tyMutable, tyTypeDesc} abstractVarRange* = {tyGenericInst, tyRange, tyVar, tyDistinct, tyOrdinal, - tyConst, tyMutable, tyTypeDesc} - abstractInst* = {tyGenericInst, tyDistinct, tyConst, tyMutable, tyOrdinal, + tyMutable, tyTypeDesc} + abstractInst* = {tyGenericInst, tyDistinct, tyMutable, tyOrdinal, tyTypeDesc} - skipPtrs* = {tyVar, tyPtr, tyRef, tyGenericInst, tyConst, tyMutable, - tyTypeDesc} + skipPtrs* = {tyVar, tyPtr, tyRef, tyGenericInst, tyMutable, tyTypeDesc} # typedescX is used if we're sure tyTypeDesc should be included (or skipped) typedescPtrs* = abstractPtrs + {tyTypeDesc} typedescInst* = abstractInst + {tyTypeDesc} @@ -116,8 +115,7 @@ proc isFloatLit*(t: PType): bool {.inline.} = proc isCompatibleToCString(a: PType): bool = if a.kind == tyArray: if (firstOrd(a.sons[0]) == 0) and - (skipTypes(a.sons[0], {tyRange, tyConst, - tyMutable, tyGenericInst}).kind in + (skipTypes(a.sons[0], {tyRange, tyMutable, tyGenericInst}).kind in {tyInt..tyInt64, tyUInt..tyUInt64}) and (a.sons[1].kind == tyChar): result = true @@ -151,13 +149,12 @@ proc isOrdinalType(t: PType): bool = const # caution: uint, uint64 are no ordinal types! baseKinds = {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum} - parentKinds = {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst, - tyDistinct} + parentKinds = {tyRange, tyOrdinal, tyMutable, tyGenericInst, tyDistinct} t.kind in baseKinds or (t.kind in parentKinds and isOrdinalType(t.sons[0])) proc enumHasHoles(t: PType): bool = var b = t - while b.kind in {tyConst, tyMutable, tyRange, tyGenericInst}: b = b.sons[0] + while b.kind in {tyMutable, tyRange, tyGenericInst}: b = b.sons[0] result = b.kind == tyEnum and tfEnumHasHoles in b.flags proc iterOverTypeAux(marker: var IntSet, t: PType, iter: TTypeIter, @@ -275,7 +272,7 @@ proc analyseObjectWithTypeFieldAux(t: PType, if res == frHeader: result = frHeader if result == frNone: if isObjectWithTypeFieldPredicate(t): result = frHeader - of tyGenericInst, tyDistinct, tyConst, tyMutable: + of tyGenericInst, tyDistinct, tyMutable: result = analyseObjectWithTypeFieldAux(lastSon(t), marker) of tyArray, tyArrayConstr, tyTuple: for i in countup(0, sonsLen(t) - 1): @@ -534,7 +531,7 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string = add(result, typeToString(t.sons[i])) if i < sonsLen(t) - 1: add(result, ", ") add(result, ')') - of tyPtr, tyRef, tyVar, tyMutable, tyConst: + of tyPtr, tyRef, tyVar, tyMutable: result = typeToStr[t.kind] if t.len >= 2: setLen(result, result.len-1) @@ -606,7 +603,7 @@ proc firstOrd(t: PType): BiggestInt = else: assert(t.n.sons[0].kind == nkSym) result = t.n.sons[0].sym.position - of tyGenericInst, tyDistinct, tyConst, tyMutable, tyTypeDesc, tyFieldAccessor: + of tyGenericInst, tyDistinct, tyMutable, tyTypeDesc, tyFieldAccessor: result = firstOrd(lastSon(t)) of tyOrdinal: if t.len > 0: result = firstOrd(lastSon(t)) @@ -642,8 +639,7 @@ proc lastOrd(t: PType): BiggestInt = of tyEnum: assert(t.n.sons[sonsLen(t.n) - 1].kind == nkSym) result = t.n.sons[sonsLen(t.n) - 1].sym.position - of tyGenericInst, tyDistinct, tyConst, tyMutable, - tyTypeDesc, tyFieldAccessor: + of tyGenericInst, tyDistinct, tyMutable, tyTypeDesc, tyFieldAccessor: result = lastOrd(lastSon(t)) of tyProxy: result = 0 of tyOrdinal: @@ -656,7 +652,7 @@ proc lastOrd(t: PType): BiggestInt = proc lengthOrd(t: PType): BiggestInt = case t.kind of tyInt64, tyInt32, tyInt: result = lastOrd(t) - of tyDistinct, tyConst, tyMutable: result = lengthOrd(t.sons[0]) + of tyDistinct, tyMutable: result = lengthOrd(t.sons[0]) else: let last = lastOrd t let first = firstOrd t @@ -965,7 +961,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = result = a.sym.position == b.sym.position of tyGenericInvocation, tyGenericBody, tySequence, tyOpenArray, tySet, tyRef, tyPtr, tyVar, tyArrayConstr, - tyArray, tyProc, tyConst, tyMutable, tyVarargs, + tyArray, tyProc, tyMutable, tyVarargs, tyOrdinal, tyTypeClasses, tyFieldAccessor: cycleCheck() if a.kind == tyUserTypeClass and a.n != nil: return a.n == b.n @@ -980,7 +976,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = sameValue(a.n.sons[1], b.n.sons[1]) of tyGenericInst: discard of tyNone: result = false - of tyUnused, tyUnused0: internalError("sameFlags") + of tyUnused, tyUnused0, tyUnused1: internalError("sameFlags") proc sameBackendType*(x, y: PType): bool = var c = initSameTypeClosure() @@ -1144,7 +1140,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind, else: result = typeAllowedAux(marker, t.lastSon, skVar, flags+{taHeap}) of tyPtr: result = typeAllowedAux(marker, t.lastSon, skVar, flags+{taHeap}) - of tyArrayConstr, tySet, tyConst, tyMutable: + of tyArrayConstr, tySet, tyMutable: for i in countup(0, sonsLen(t) - 1): result = typeAllowedAux(marker, t.sons[i], kind, flags) if result != nil: break @@ -1161,7 +1157,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind, # for now same as error node; we say it's a valid type as it should # prevent cascading errors: result = nil - of tyUnused, tyUnused0: internalError("typeAllowedAux") + of tyUnused, tyUnused0, tyUnused1: internalError("typeAllowedAux") proc typeAllowed*(t: PType, kind: TSymKind): PType = # returns 'nil' on success and otherwise the part of the type that is @@ -1312,7 +1308,7 @@ proc computeSizeAux(typ: PType, a: var BiggestInt): BiggestInt = if result < 0: return if a < maxAlign: a = maxAlign result = align(result, a) - of tyGenericInst, tyDistinct, tyGenericBody, tyMutable, tyConst: + of tyGenericInst, tyDistinct, tyGenericBody, tyMutable: result = computeSizeAux(lastSon(typ), a) of tyTypeDesc: result = computeSizeAux(typ.base, a) diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index becef1c5d..5c48c63d5 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -266,7 +266,6 @@ proc mapTypeToAstX(t: PType; info: TLineInfo; of tyUInt16: result = atomicType("uint16", mUint16) of tyUInt32: result = atomicType("uint32", mUint32) of tyUInt64: result = atomicType("uint64", mUint64) - of tyConst: result = mapTypeToBracket("const", mNone, t, info) of tyMutable: result = mapTypeToBracket("mutable", mNone, t, info) of tyVarargs: result = mapTypeToBracket("varargs", mVarargs, t, info) of tyProxy: result = atomicType("error", mNone) @@ -290,7 +289,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo; result.add atomicType("static", mNone) if t.n != nil: result.add t.n.copyTree - of tyUnused, tyUnused0: internalError("mapTypeToAstX") + of tyUnused, tyUnused0, tyUnused1: internalError("mapTypeToAstX") proc opMapTypeToAst*(t: PType; info: TLineInfo): PNode = result = mapTypeToAstX(t, info, false, true) diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 34cb69d61..8dfe69a90 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -91,7 +91,7 @@ type ntyFloat, ntyFloat32, ntyFloat64, ntyFloat128, ntyUInt, ntyUInt8, ntyUInt16, ntyUInt32, ntyUInt64, ntyUnused0, - ntyConst, ntyMutable, ntyVarargs, + ntyUnused1, ntyMutable, ntyVarargs, ntyUnused, ntyError, ntyBuiltinTypeClass, ntyConcept, ntyConceptInst, ntyComposite, From f5c3eb6a254e9e9f8c6389cb9f707a6ff878bd5c Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 24 Oct 2016 23:30:10 +0800 Subject: [PATCH 15/15] clean up tyMutable remnants --- compiler/ast.nim | 6 +++--- compiler/ccgtypes.nim | 4 ++-- compiler/ccgutils.nim | 4 ++-- compiler/jsgen.nim | 5 ++--- compiler/renderer.nim | 3 +-- compiler/semasgn.nim | 4 ++-- compiler/semdestruct.nim | 2 +- compiler/types.nim | 46 ++++++++++++++++++---------------------- compiler/vmdeps.nim | 3 +-- lib/core/macros.nim | 4 ++-- 10 files changed, 37 insertions(+), 44 deletions(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index 943fdacc0..5c9252bee 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -349,9 +349,9 @@ type tyInt, tyInt8, tyInt16, tyInt32, tyInt64, # signed integers tyFloat, tyFloat32, tyFloat64, tyFloat128, tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64, - tyUnused0, - tyUnused1, tyMutable, tyVarargs, - tyUnused + tyUnused0, tyUnused1, tyUnused2, + tyVarargs, + tyUnused, tyProxy # used as errornous type (for idetools) tyBuiltInTypeClass #\ diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 3ebd9bb27..bd2e2cdda 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -122,7 +122,7 @@ proc mapType(typ: PType): TCTypeKind = of tyOpenArray, tyArrayConstr, tyArray, tyVarargs: result = ctArray of tyObject, tyTuple: result = ctStruct of tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal, - tyMutable, tyTypeDesc: + tyTypeDesc: result = mapType(lastSon(typ)) of tyEnum: if firstOrd(typ) < 0: @@ -711,7 +711,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var IntSet): Rope = of 1, 2, 4, 8: addf(m.s[cfsTypes], "typedef NU$2 $1;$n", [result, rope(s*8)]) else: addf(m.s[cfsTypes], "typedef NU8 $1[$2];$n", [result, rope(getSize(t))]) - of tyGenericInst, tyDistinct, tyOrdinal, tyMutable, tyTypeDesc: + of tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc: result = getTypeDescAux(m, lastSon(t), check) else: internalError("getTypeDescAux(" & $t.kind & ')') diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim index 7a0d39101..2216cb4fd 100644 --- a/compiler/ccgutils.nim +++ b/compiler/ccgutils.nim @@ -106,7 +106,7 @@ proc getUniqueType*(key: PType): PType = of tyDistinct: if key.deepCopy != nil: result = key else: result = getUniqueType(lastSon(key)) - of tyGenericInst, tyOrdinal, tyMutable, tyStatic: + of tyGenericInst, tyOrdinal, tyStatic: result = getUniqueType(lastSon(key)) #let obj = lastSon(key) #if obj.sym != nil and obj.sym.name.s == "TOption": @@ -153,7 +153,7 @@ proc getUniqueType*(key: PType): PType = else: # ugh, we need the canon here: result = slowSearch(key, k) - of tyUnused, tyUnused0, tyUnused1: internalError("getUniqueType") + of tyUnused, tyUnused0, tyUnused1, tyUnused2: internalError("getUniqueType") proc tableGetType*(tab: TIdTable, key: PType): RootRef = # returns nil if we need to declare this type diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index ac1a79f2e..891e68f77 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -151,8 +151,7 @@ proc mapType(typ: PType): TJSTypeKind = of tyPointer: # treat a tyPointer like a typed pointer to an array of bytes result = etyBaseIndex - of tyRange, tyDistinct, tyOrdinal, tyMutable, tyProxy: - result = mapType(t.sons[0]) + of tyRange, tyDistinct, tyOrdinal, tyProxy: result = mapType(t.sons[0]) of tyInt..tyInt64, tyUInt..tyUInt64, tyEnum, tyChar: result = etyInt of tyBool: result = etyBool of tyFloat..tyFloat128: result = etyFloat @@ -170,7 +169,7 @@ proc mapType(typ: PType): TJSTypeKind = else: result = etyNone of tyProc: result = etyProc of tyCString: result = etyString - of tyUnused, tyUnused0, tyUnused1: internalError("mapType") + of tyUnused, tyUnused0, tyUnused1, tyUnused2: internalError("mapType") proc mapType(p: PProc; typ: PType): TJSTypeKind = if p.target == targetPHP: result = etyObject diff --git a/compiler/renderer.nim b/compiler/renderer.nim index a35096035..d06269156 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -289,8 +289,7 @@ proc lsub(n: PNode): int proc litAux(n: PNode, x: BiggestInt, size: int): string = proc skip(t: PType): PType = result = t - while result.kind in {tyGenericInst, tyRange, tyVar, tyDistinct, tyOrdinal, - tyMutable}: + while result.kind in {tyGenericInst, tyRange, tyVar, tyDistinct, tyOrdinal}: result = lastSon(result) if n.typ != nil and n.typ.skip.kind in {tyBool, tyEnum}: let enumfields = n.typ.skip.n diff --git a/compiler/semasgn.nim b/compiler/semasgn.nim index 7748cf889..c4116a814 100644 --- a/compiler/semasgn.nim +++ b/compiler/semasgn.nim @@ -223,13 +223,13 @@ proc liftBodyAux(c: var TLiftCtx; t: PType; body, x, y: PNode) = localError(c.info, errGenerated, "cannot copy openArray") of tyFromExpr, tyProxy, tyBuiltInTypeClass, tyUserTypeClass, tyUserTypeClassInst, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything, - tyMutable, tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt, + tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt, tyTypeDesc, tyGenericInvocation, tyForward: internalError(c.info, "assignment requested for type: " & typeToString(t)) of tyOrdinal, tyRange, tyGenericInst, tyFieldAccessor, tyStatic, tyVar: liftBodyAux(c, lastSon(t), body, x, y) - of tyUnused, tyUnused0, tyUnused1: internalError("liftBodyAux") + of tyUnused, tyUnused0, tyUnused1, tyUnused2: internalError("liftBodyAux") proc newProcType(info: TLineInfo; owner: PSym): PType = result = newType(tyProc, owner) diff --git a/compiler/semdestruct.nim b/compiler/semdestruct.nim index efaa2b7cf..85d106056 100644 --- a/compiler/semdestruct.nim +++ b/compiler/semdestruct.nim @@ -124,7 +124,7 @@ proc instantiateDestructor(c: PContext, typ: PType): PType = # destructor that must be used for the varialbe. # The destructor is either user-defined or automatically # generated by the compiler in a member-wise fashion. - var t = skipTypes(typ, {tyMutable}).skipGenericAlias + var t = typ.skipGenericAlias let typeHoldingUserDefinition = if t.kind == tyGenericInst: t.base else: t if typeHoldingUserDefinition.destructor != nil: diff --git a/compiler/types.nim b/compiler/types.nim index df4574a55..fc50449ec 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -51,17 +51,14 @@ const # TODO: Remove tyTypeDesc from each abstractX and (where necessary) # replace with typedescX abstractPtrs* = {tyVar, tyPtr, tyRef, tyGenericInst, tyDistinct, tyOrdinal, - tyMutable, tyTypeDesc} - abstractVar* = {tyVar, tyGenericInst, tyDistinct, tyOrdinal, - tyMutable, tyTypeDesc} - abstractRange* = {tyGenericInst, tyRange, tyDistinct, tyOrdinal, - tyMutable, tyTypeDesc} - abstractVarRange* = {tyGenericInst, tyRange, tyVar, tyDistinct, tyOrdinal, - tyMutable, tyTypeDesc} - abstractInst* = {tyGenericInst, tyDistinct, tyMutable, tyOrdinal, tyTypeDesc} + abstractVar* = {tyVar, tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc} + abstractRange* = {tyGenericInst, tyRange, tyDistinct, tyOrdinal, tyTypeDesc} + abstractVarRange* = {tyGenericInst, tyRange, tyVar, tyDistinct, tyOrdinal, + tyTypeDesc} + abstractInst* = {tyGenericInst, tyDistinct, tyOrdinal, tyTypeDesc} - skipPtrs* = {tyVar, tyPtr, tyRef, tyGenericInst, tyMutable, tyTypeDesc} + skipPtrs* = {tyVar, tyPtr, tyRef, tyGenericInst, tyTypeDesc} # typedescX is used if we're sure tyTypeDesc should be included (or skipped) typedescPtrs* = abstractPtrs + {tyTypeDesc} typedescInst* = abstractInst + {tyTypeDesc} @@ -115,7 +112,7 @@ proc isFloatLit*(t: PType): bool {.inline.} = proc isCompatibleToCString(a: PType): bool = if a.kind == tyArray: if (firstOrd(a.sons[0]) == 0) and - (skipTypes(a.sons[0], {tyRange, tyMutable, tyGenericInst}).kind in + (skipTypes(a.sons[0], {tyRange, tyGenericInst}).kind in {tyInt..tyInt64, tyUInt..tyUInt64}) and (a.sons[1].kind == tyChar): result = true @@ -149,12 +146,12 @@ proc isOrdinalType(t: PType): bool = const # caution: uint, uint64 are no ordinal types! baseKinds = {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum} - parentKinds = {tyRange, tyOrdinal, tyMutable, tyGenericInst, tyDistinct} + parentKinds = {tyRange, tyOrdinal, tyGenericInst, tyDistinct} t.kind in baseKinds or (t.kind in parentKinds and isOrdinalType(t.sons[0])) proc enumHasHoles(t: PType): bool = var b = t - while b.kind in {tyMutable, tyRange, tyGenericInst}: b = b.sons[0] + while b.kind in {tyRange, tyGenericInst}: b = b.sons[0] result = b.kind == tyEnum and tfEnumHasHoles in b.flags proc iterOverTypeAux(marker: var IntSet, t: PType, iter: TTypeIter, @@ -272,7 +269,7 @@ proc analyseObjectWithTypeFieldAux(t: PType, if res == frHeader: result = frHeader if result == frNone: if isObjectWithTypeFieldPredicate(t): result = frHeader - of tyGenericInst, tyDistinct, tyMutable: + of tyGenericInst, tyDistinct: result = analyseObjectWithTypeFieldAux(lastSon(t), marker) of tyArray, tyArrayConstr, tyTuple: for i in countup(0, sonsLen(t) - 1): @@ -405,8 +402,8 @@ const "int", "int8", "int16", "int32", "int64", "float", "float32", "float64", "float128", "uint", "uint8", "uint16", "uint32", "uint64", - "bignum", "const ", - "!", "varargs[$1]", "iter[$1]", "Error Type", + "unused0", "unused1", + "unused2", "varargs[$1]", "unused", "Error Type", "BuiltInTypeClass", "UserTypeClass", "UserTypeClassInst", "CompositeTypeClass", "and", "or", "not", "any", "static", "TypeFromExpr", "FieldAccessor", @@ -531,7 +528,7 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string = add(result, typeToString(t.sons[i])) if i < sonsLen(t) - 1: add(result, ", ") add(result, ')') - of tyPtr, tyRef, tyVar, tyMutable: + of tyPtr, tyRef, tyVar: result = typeToStr[t.kind] if t.len >= 2: setLen(result, result.len-1) @@ -603,7 +600,7 @@ proc firstOrd(t: PType): BiggestInt = else: assert(t.n.sons[0].kind == nkSym) result = t.n.sons[0].sym.position - of tyGenericInst, tyDistinct, tyMutable, tyTypeDesc, tyFieldAccessor: + of tyGenericInst, tyDistinct, tyTypeDesc, tyFieldAccessor: result = firstOrd(lastSon(t)) of tyOrdinal: if t.len > 0: result = firstOrd(lastSon(t)) @@ -639,7 +636,7 @@ proc lastOrd(t: PType): BiggestInt = of tyEnum: assert(t.n.sons[sonsLen(t.n) - 1].kind == nkSym) result = t.n.sons[sonsLen(t.n) - 1].sym.position - of tyGenericInst, tyDistinct, tyMutable, tyTypeDesc, tyFieldAccessor: + of tyGenericInst, tyDistinct, tyTypeDesc, tyFieldAccessor: result = lastOrd(lastSon(t)) of tyProxy: result = 0 of tyOrdinal: @@ -652,7 +649,7 @@ proc lastOrd(t: PType): BiggestInt = proc lengthOrd(t: PType): BiggestInt = case t.kind of tyInt64, tyInt32, tyInt: result = lastOrd(t) - of tyDistinct, tyMutable: result = lengthOrd(t.sons[0]) + of tyDistinct: result = lengthOrd(t.sons[0]) else: let last = lastOrd t let first = firstOrd t @@ -961,8 +958,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = result = a.sym.position == b.sym.position of tyGenericInvocation, tyGenericBody, tySequence, tyOpenArray, tySet, tyRef, tyPtr, tyVar, tyArrayConstr, - tyArray, tyProc, tyMutable, tyVarargs, - tyOrdinal, tyTypeClasses, tyFieldAccessor: + tyArray, tyProc, tyVarargs, tyOrdinal, tyTypeClasses, tyFieldAccessor: cycleCheck() if a.kind == tyUserTypeClass and a.n != nil: return a.n == b.n result = sameChildrenAux(a, b, c) and sameFlags(a, b) @@ -976,7 +972,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = sameValue(a.n.sons[1], b.n.sons[1]) of tyGenericInst: discard of tyNone: result = false - of tyUnused, tyUnused0, tyUnused1: internalError("sameFlags") + of tyUnused, tyUnused0, tyUnused1, tyUnused2: internalError("sameFlags") proc sameBackendType*(x, y: PType): bool = var c = initSameTypeClosure() @@ -1140,7 +1136,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind, else: result = typeAllowedAux(marker, t.lastSon, skVar, flags+{taHeap}) of tyPtr: result = typeAllowedAux(marker, t.lastSon, skVar, flags+{taHeap}) - of tyArrayConstr, tySet, tyMutable: + of tyArrayConstr, tySet: for i in countup(0, sonsLen(t) - 1): result = typeAllowedAux(marker, t.sons[i], kind, flags) if result != nil: break @@ -1157,7 +1153,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind, # for now same as error node; we say it's a valid type as it should # prevent cascading errors: result = nil - of tyUnused, tyUnused0, tyUnused1: internalError("typeAllowedAux") + of tyUnused, tyUnused0, tyUnused1, tyUnused2: internalError("typeAllowedAux") proc typeAllowed*(t: PType, kind: TSymKind): PType = # returns 'nil' on success and otherwise the part of the type that is @@ -1308,7 +1304,7 @@ proc computeSizeAux(typ: PType, a: var BiggestInt): BiggestInt = if result < 0: return if a < maxAlign: a = maxAlign result = align(result, a) - of tyGenericInst, tyDistinct, tyGenericBody, tyMutable: + of tyGenericInst, tyDistinct, tyGenericBody: result = computeSizeAux(lastSon(typ), a) of tyTypeDesc: result = computeSizeAux(typ.base, a) diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index 5c48c63d5..01811197f 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -266,7 +266,6 @@ proc mapTypeToAstX(t: PType; info: TLineInfo; of tyUInt16: result = atomicType("uint16", mUint16) of tyUInt32: result = atomicType("uint32", mUint32) of tyUInt64: result = atomicType("uint64", mUint64) - of tyMutable: result = mapTypeToBracket("mutable", mNone, t, info) of tyVarargs: result = mapTypeToBracket("varargs", mVarargs, t, info) of tyProxy: result = atomicType("error", mNone) of tyBuiltInTypeClass: @@ -289,7 +288,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo; result.add atomicType("static", mNone) if t.n != nil: result.add t.n.copyTree - of tyUnused, tyUnused0, tyUnused1: internalError("mapTypeToAstX") + of tyUnused, tyUnused0, tyUnused1, tyUnused2: internalError("mapTypeToAstX") proc opMapTypeToAst*(t: PType; info: TLineInfo): PNode = result = mapTypeToAstX(t, info, false, true) diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 8dfe69a90..5c5b82898 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -90,8 +90,8 @@ type ntyInt8, ntyInt16, ntyInt32, ntyInt64, ntyFloat, ntyFloat32, ntyFloat64, ntyFloat128, ntyUInt, ntyUInt8, ntyUInt16, ntyUInt32, ntyUInt64, - ntyUnused0, - ntyUnused1, ntyMutable, ntyVarargs, + ntyUnused0, ntyUnused1, ntyUnused2, + ntyVarargs, ntyUnused, ntyError, ntyBuiltinTypeClass, ntyConcept, ntyConceptInst, ntyComposite,