diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-09-15 09:27:51 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-09-15 09:27:51 +0200 |
commit | 39f0195ebf30cc9f4b96953423298d7a2130eac8 (patch) | |
tree | bb4daf580c239b59d232e186814b69fc642ce6d5 /lib/js/jsffi.nim | |
parent | bc738d63a728ee6030cc224c8808990a6f641feb (diff) | |
parent | 2ef65d5cdf3d65cbfab4c39796ddb4e70e9ebb37 (diff) | |
download | Nim-39f0195ebf30cc9f4b96953423298d7a2130eac8.tar.gz |
Merge branch 'devel' into araq
Diffstat (limited to 'lib/js/jsffi.nim')
-rw-r--r-- | lib/js/jsffi.nim | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/js/jsffi.nim b/lib/js/jsffi.nim index 3b3f38e41..0d359d9e6 100644 --- a/lib/js/jsffi.nim +++ b/lib/js/jsffi.nim @@ -408,20 +408,19 @@ macro `{}`*(typ: typedesc, xs: varargs[untyped]): auto = kString = quote do: when compiles($`k`): $`k` else: "invalid" v = x[1] - body.add(quote do: + body.add quote do: when compiles(`a`.`k`): `a`.`k` = `v` elif compiles(`a`[`k`]): `a`[`k`] = `v` else: `a`[`kString`] = `v` - ) + else: error("Expression `" & $x.toStrLit & "` not allowed in `{}` macro") - body.add(quote do: + body.add quote do: return `a` - ) result = quote do: proc inner(): `typ` {.gensym.} = |