Closed Bug 559402 Opened 10 years ago Closed 9 years ago

"use strict" reported as strict mode warning 'useless expression'

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla2.0b9
Tracking Status
status2.0 --- ?

People

(Reporter: philip, Assigned: brendan)

References

(Blocks 1 open bug)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

$ ./js
  js> options("strict");
  ""
  js> function foo() { "use strict"; }
  typein:2: strict warning: useless expression:
  typein:2: strict warning: function foo() { "use strict"; }
  typein:2: strict warning: .................^
  js>

Preferably it shouldn't be reported as useless.
Blocking bug 482298 (es5strict)?
Assignee: general → brendan
Status: NEW → ASSIGNED
Attachment #500236 - Flags: review?(jimb)
status2.0: --- → ?
OS: Linux → All
Priority: -- → P3
Hardware: x86 → All
Target Milestone: --- → mozilla2.0b9
Comment on attachment 500236 [details] [diff] [review]
easy fix for ES5 strict + javascript.options.strict pain-point

I think you want it to influence "useful", but not "wantval".  Without patch:

js> function f() { "taunt"; } f()
js> 

With patch:

js> function f() { "taunt"; } f()
"taunt"
js> 

(... there's no test for that?)
Attachment #500236 - Flags: review?(jimb) → review-
for thes sake of ES5 strict + (common, legacy) strict option setting.

/be
Attachment #500236 - Attachment is obsolete: true
Attachment #501862 - Flags: review?(jimb)
Comment on attachment 501862 [details] [diff] [review]
less easy fix but still easy enough to justify spending a few minutes on

Looks good to me!
Attachment #501862 - Flags: review?(jimb) → review+
http://hg.mozilla.org/tracemonkey/rev/8ea7ed461dc0

/be
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/8ea7ed461dc0
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Depends on: 624199
You need to log in before you can comment on or make changes to this bug.