Closed Bug 1775215 Opened 3 years ago Closed 1 year ago

When using a key word as a identifier report something better than 'SyntaxError: missing variable name'

Categories

(Core :: JavaScript Engine, enhancement, P3)

Firefox 100
enhancement

Tracking

()

RESOLVED FIXED
135 Branch
Tracking Status
firefox135 --- fixed

People

(Reporter: 845043157, Assigned: abdoatef.ab, Mentored)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0

Steps to reproduce:

run the program:
var else;

Actual results:

SyntaxError:missing variable name

Expected results:

SyntaxError:Cannot use the keyword 'else' as a variable name.(JSC)
SyntaxError:Unexpected token 'else'.(V8)

It is obvious that the error is wrong variable name rather than missing variable name when i use a key word as a identifier.
It also has the same problem when i use 'arguments','break','case','catch','class',

'const','continue','debugger','default','delete','do','else','enum','export','extends','false','finally','for','function','if','import','in','instanceof','new','null','return','super','switch','this','throw','true','try','typeof','var','void','while','with'.

Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Version: Firefox 101 → Firefox 100

This would certainly be a nice improvement.

Severity: -- → N/A
Type: defect → enhancement
Priority: -- → P3
Summary: When use a key word as a identifier,it report 'SyntaxError:missing variable name' → When using a key word as a identifier report something better than 'SyntaxError: missing variable name'
Mentor: dminor
Assignee: nobody → abdoatef.ab
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9444560 - Attachment is obsolete: true
Attachment #9444560 - Attachment is obsolete: false
Attachment #9444560 - Attachment description: Bug 1775215 - Add better error reporting when using keyword as identifier. r=dminor → Bug 1775215 - Add token kind description to missing variable error message. r=dminor
Pushed by dminor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9cca17e0706b Add token kind description to missing variable error message. r=dminor
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: