Closed Bug 1263074 Opened 8 years ago Closed 8 years ago

Change the JavaScript syntax error message for the old octal literal notation to suggest the new notation

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: jwatt, Assigned: jwatt)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Using the old "0" prefixed octal literal notation results in:

  SyntaxError: octal literals and octal escape sequences are deprecated

We now have the new "0o" prefixed octal literal notation though, so this error message is somewhat misleading.
Attached patch patchSplinter Review
Attachment #8739303 - Flags: review?(luke)
Comment on attachment 8739303 [details] [diff] [review]
patch

Forwarding to someone who I recall saying "octal" a lot a while ago...
Attachment #8739303 - Flags: review?(luke) → review?(jwalden+bmo)
Comment on attachment 8739303 [details] [diff] [review]
patch

Review of attachment 8739303 [details] [diff] [review]:
-----------------------------------------------------------------

Yeah, I thought about doing this when octal literals were added but decided it was a bit early to suggest it.  A couple years later, this seems much safer.

::: js/src/js.msg
@@ +237,5 @@
>  MSG_DEF(JSMSG_DEPRECATED_DELETE_OPERAND, 0, JSEXN_SYNTAXERR, "applying the 'delete' operator to an unqualified name is deprecated")
>  MSG_DEF(JSMSG_DEPRECATED_EXPR_CLOSURE, 0, JSEXN_NONE, "expression closures are deprecated")
>  MSG_DEF(JSMSG_DEPRECATED_FLAGS_ARG,    0, JSEXN_NONE, "flags argument of String.prototype.{search,match,replace} is deprecated")
>  MSG_DEF(JSMSG_DEPRECATED_FOR_EACH,     0, JSEXN_NONE, "JavaScript 1.6's for-each-in loops are deprecated; consider using ES6 for-of instead")
> +MSG_DEF(JSMSG_DEPRECATED_OCTAL,        0, JSEXN_SYNTAXERR, "\"0\" prefixed octal literals and octal escape sequences are deprecated; for octal literals use the \"0o\" prefix instead")

"0"-prefixed, maybe?  Adjectival phrase or something.
Attachment #8739303 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/2e461f39cc00
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: