Closed
Bug 22243
Opened 26 years ago
Closed 26 years ago
Illegally constructed catchguards should throw an exception
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
VERIFIED
FIXED
People
(Reporter: rginda, Assigned: shaver)
References
()
Details
(Keywords: js1.5, Whiteboard: fix awaiting review [Jan 16])
Attachments
(2 files)
|
4.35 KB,
patch
|
Details | Diff | Splinter Review | |
|
4.07 KB,
patch
|
Details | Diff | Splinter Review |
try {
throw "foo";
}
catch (e) {
foo();
} catch (e if true)
bar();
}
Should throw an exception because the catchall comes before the guarded catch
| Reporter | ||
Updated•26 years ago
|
Whiteboard: [JS15]
| Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 1•26 years ago
|
||
This used to work -- I'll take a look. How long do I have?
(mccabe was involved in the original catchguard-ectomy, maybe he recalls what
happened to this logic?)
| Reporter | ||
Comment 2•26 years ago
|
||
The sooner the better, looking for a 1.5 final in less than two weeks.
Removing [JS15] from Status Summary, putting js1.5 in new Keyword field :-)
| Assignee | ||
Updated•26 years ago
|
Whiteboard: fix awaiting review [Jan 16]
| Assignee | ||
Comment 4•26 years ago
|
||
How about:
js> load('/tmp/catch.js');
/tmp/catch.js:5: SyntaxError: conditional catch after unconditional catch:
/tmp/catch.js:5: } catch (e if true) {
/tmp/catch.js:5: ...........^
js>
I'm _tempted_ to make it a warning rather than an error, but not incredibly so.
I'll attach the patch (against JS15_20000111_BRANCH), which includes the fix for
22245 previously mailed privately to rginda and brendan.
| Assignee | ||
Comment 5•26 years ago
|
||
Comment 6•26 years ago
|
||
I applied the patch (with some effort - looks like your diff is against stuff
that isn't in the tree!) and looks like it does the trick.
js> try { a + b } catch (a) { } catch (b if 4) { }
8: conditional catch after unconditional catch:
8: try { a + b } catch (a) { } catch (b if 4) { }
8: ...................................^
JS accepts multiple unconditional catchguards without complaint:
js> try { a + b } catch (a) { } catch (b) { }
This is a similar case - it should probably be an error as well.
r=mccabe.
| Assignee | ||
Comment 7•26 years ago
|
||
My patch is against the branch -- were you working with the tip? I'll make the
change you mention (any catch after a unconditional catch is an error), and
repost.
| Assignee | ||
Comment 8•26 years ago
|
||
| Assignee | ||
Comment 9•26 years ago
|
||
js> try { a + b } catch (a) { } catch (b if 4) { }
2: catch after unconditional catch:
2: try { a + b } catch (a) { } catch (b if 4) { }
2: ............................^
js>
mccabe, did you review against 22245 as well?
Comment 10•26 years ago
|
||
r=brendan@mozilla.org (with fix for comment nit that I whined to shaver about
privately).
/be
Comment 11•26 years ago
|
||
Shaver, you wanna check this into JS15_20000111_BRANCH and I'll land it? I want
to land stuff today.
/be
Updated•26 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Comment 12•26 years ago
|
||
I landed the branch with shaver's fix to this bug. Mail from shaver reminds
me: isn't 22245 INVALID due to a bogus testcase?
/be
| Reporter | ||
Comment 13•26 years ago
|
||
Exceptions/catchguard-003-n.js added to cover
mccabe's catch (e) {} catch (e) {} case.
You need to log in
before you can comment on or make changes to this bug.
Description
•