[Webkit-unassigned] [Bug 244018] 'a\n' is considered as a variable

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 18 01:27:59 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=244018

--- Comment #4 from 845043157 at qq.com ---
'\n' is illegal in variable name and function name.'var a\nb=1' will throw a SyntaxError.So print 'TypeError: a\n is not a function.' may be not a good idea.It regard 'a\n' as a variable name.

But '\n' is meaningless in the end of variable name and function name and will be ignored.

If running the following program:
var a
=1;
print(a);
print(a
);
a=2;
print(a);
print(a
);

It output:
1
1
2
2

So during compilation,'\n' in the end of variable name and function name will be ignored.The '\n' of variable name 'a\n' will be ignored and 'a\n' is regarded as 'a'.

I think 'TypeError:a is not a function' is better.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220818/4a42660b/attachment-0001.htm>


More information about the webkit-unassigned mailing list