qcert icon indicating copy to clipboard operation
qcert copied to clipboard

Javascript backend does not avoid keywords correctly

Open shinnar opened this issue 7 years ago • 2 comments

It prefixes all variables emmitted with "v", but the avoidance code does not account for this. As a result, "this", for example, is suffixed to avoid a conflict (needlessly, since it is already prefixed with v), but "ar" is not, which is an actual problem -- since we then output a variable called "var"!

shinnar avatar Jan 10 '18 20:01 shinnar

we currently are prepending "v" (and now "vc$") to our emitted variables, but we check for javascript keyword conflicts with the un-prepended version. So it complains about "this", but not about "ar" (well not for the free variable/constant "this", since it looks like "c$this" to the unshadower, but that is a hack on top of a hack rather then a fix).

shinnar avatar Jan 11 '18 02:01 shinnar

Question about this: why do we prepend at all? Shouldn't the clean-up logic prevent the need to prepend?

jeromesimeon avatar Jan 11 '18 20:01 jeromesimeon