Netjs
Netjs copied to clipboard
char literals are not transpiled correctly (using charCodeAt instead of charAt)
C# code:
char c = line[i];
if (c == '\"')
{
if (inDoubleQuote)
{
inDoubleQuote = false;
dataFields.Add('\"' + field);
field = string.Empty;
}
else
{
inDoubleQuote = true;
}
}
Is transpiled to:
var c: number = line.charCodeAt(i);
if (c === 34/*'"'*/)
{
if (flag)
{
flag = false;
list.Add(34 + /*'"'*/text);
text = NString.Empty;
}
else
{
flag = true;
}
}
Obviously, this breaks string + char addition where the char came from a string (see the 'list.Add' line). Is there a way to prefer using charAt instead of charCodeAt?
Ouch. I will need to think about this. I did have a reason to prefer charCode, but I don't recall what it was. I'll look into it.