Open mildred opened 4 years ago
I was wrong with value
not bound in scope, there is in scope the dom
module with:
proc value*(n: Node): cstring {.importcpp: "#.value", nodecl.}
proc `value=`*(n: Node; v: cstring) {.importcpp: "#.value = #", nodecl.}
It seems the first procedure has been used but without any argument, and the #
has been preserved in the javascript output.
I got a strange javascript error with my code:
SyntaxError: private fields are not currently supported
The generated javascript function looks like:
The error is:
(re_12246262.node).value = #.value;
which is obviously not a valid javascript syntax (or perhaps will be with private fields, but I suppose this was not intended). The nim procedure is:There is an error in the above function, on its last line (
re.node.toJs.value = value
), thevalue
on the right hand side is not bound to a function argument. I believe it's not bound in the global scope too (but perhaps I'm wrong here). In any case, it should not produce erroneous javascript.The correct writing of that line is:
re.node.toJs.value = re.data.toJs
I believe the compiler should have stopped producing an error telling that
value
cannot be bound to anything.The error can be reproduced with: https://github.com/mildred/nclearseam/commit/5706b88750033dd13f2f0cd1f9cb1f2e40fce009
Nim version: