Started working on js compilation
h3rald h3rald@h3rald.com
Sat, 19 Dec 2020 13:25:40 +0000
4 files changed,
26 insertions(+),
14 deletions(-)
M
core/interpreter.nim
→
core/interpreter.nim
@@ -196,7 +196,10 @@
proc dequote*(i: In, q: var MinValue) {.extern:"min_exported_symbol_$1".}= if q.kind == minQuotation: i.withScope(): - let qqval = deepCopy(q.qVal) + when defined(js): + let qqval = q.qval + else: + let qqval = deepCopy(q.qVal) for v in q.qVal: i.push v q.qVal = qqval
M
core/minilogger.nim
→
core/minilogger.nim
@@ -26,17 +26,22 @@ of lvlFatal:
return ("(x)") else: return (" ") - -proc log*(level: Level; args: varargs[string, `$`]) = - var f = stdout - if level >= LOGLEVEL: - if level >= lvlWarn: - f = stderr - let prefix = level.logPrefix() - f.write(prefix&" ") - f.write(args.join(" ")) - f.write("\n") - if level in {lvlError, lvlFatal}: flushFile(f) +when defined(js): + proc log*(level: Level; args: varargs[string, `$`]) = + #TODOJS + discard + +else: + proc log*(level: Level; args: varargs[string, `$`]) = + var f = stdout + if level >= LOGLEVEL: + if level >= lvlWarn: + f = stderr + let prefix = level.logPrefix() + f.write(prefix&" ") + f.write(args.join(" ")) + f.write("\n") + if level in {lvlError, lvlFatal}: flushFile(f) proc fatal*(args: varargs[string, `$`]) = log(lvlFatal, args)@@ -83,4 +88,4 @@ else:
val = "warn" lvl = lvlWarn LOGLEVEL = lvl - return val+ return val
M
core/parser.nim
→
core/parser.nim
@@ -750,7 +750,10 @@ else:
raiseUndefined(p, "Undefined value: '"&p.a&"'") proc print*(a: MinValue) {.extern:"min_exported_symbol_$1".}= - stdout.write($$a) + when defined(js): + discard #TODOJS + else: + stdout.write($$a) # Predicates