Closed
Bug 384279
Opened 17 years ago
Closed 9 years ago
Strict warning "does not always return a value" even occurs when the function is missing its closing brace
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: jruderman, Unassigned)
References
Details
(Keywords: testcase)
js> options("strict"); eval("function f(a) { if(a) return 1;")
typein:1: strict warning: function f does not always return a value:
typein:1: strict warning: function f(a) { if(a) return 1;
typein:1: strict warning: ..............................^
typein:1: SyntaxError: missing } after function body:
typein:1: function f(a) { if(a) return 1;
typein:1: ..............................^
I don't think the strict warning is necessary here :)
Comment 1•17 years ago
|
||
Why is this error not necessary?
Consider: f(undefined)
Reporter | ||
Comment 2•17 years ago
|
||
Because the function doesn't even compile. If the function had a closing brace, the warning would be appropriate.
Comment 3•17 years ago
|
||
Oh, hah! I added that "}" assuming you had typod.
I get this in a current trunk build of the shell:
js> options("strict"); eval("function f(a) { if(a) return 1;")
typein:1: SyntaxError: missing } after function body:
typein:1: function f(a) { if(a) return 1;
typein:1: ..............................^
Comment 4•17 years ago
|
||
Oh, interesting. This is different depending on how I start the shell!
crowdermac:~/mozilla/js/src crowder$ ./Darwin_DBG.OBJ/js -s
js> options("strict"); eval("function f(a) { if(a) return 1;")
typein:1: SyntaxError: missing } after function body:
typein:1: function f(a) { if(a) return 1;
typein:1: ..............................^
crowdermac:~/mozilla/js/src crowder$ ./Darwin_DBG.OBJ/js
js> options("strict"); eval("function f(a) { if(a) return 1;")
typein:1: strict warning: function f does not always return a value:
typein:1: strict warning: function f(a) { if(a) return 1;
typein:1: strict warning: ..............................^
typein:1: SyntaxError: missing } after function body:
typein:1: function f(a) { if(a) return 1;
typein:1: ..............................^
Reporter | ||
Comment 5•17 years ago
|
||
options("strict") is a toggle. Should it not be a toggle?
Comment 6•17 years ago
|
||
My bad, I thought it wasn't.
Comment 7•17 years ago
|
||
All of the options are toggles and are a pita but I've got work arounds for it. If you want to change it, please wait for a bit until I can get caught up on other things.
Updated•13 years ago
|
OS: Mac OS X → All
Hardware: x86 → All
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Comment 8•9 years ago
|
||
Strict warning "does not always return a value" was removed in http://hg.mozilla.org/mozilla-central/rev/a470d0cbe3fa (bug 1046964)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•