Closed
Bug 408957
Opened 17 years ago
Closed 17 years ago
let declaration must be direct child of block, top-level implicit block, or switch body block
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.9beta3
People
(Reporter: brendan, Assigned: brendan)
References
Details
Attachments
(1 file)
31.03 KB,
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
See http://bugs.ecmascript.org/ticket/280 -- this is much saner than what we did in JS1.7, it will simplify the decompiler as well as the compiler. We should do it for Mozilla 1.9 / Firefox 3 to prepare for JS2.
/be
Assignee | ||
Updated•17 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P1
Assignee | ||
Comment 1•17 years ago
|
||
Want to get this in and shake the trees for anything it might break (I would be surprised, but not stunned...).
/be
Attachment #295157 -
Flags: review?(mrbkap)
Assignee | ||
Comment 2•17 years ago
|
||
Besides tracking JS2/ES4, this reduces code footprint and attack surface (consider the decompiler's track record). It also will close a bunch of bugs Jesse filed, on the limitations of the decompiler's let-in-non-block-triggered magic unbracer. Jesse, can you id those bugs?
/be
Flags: blocking1.9+
Comment 3•17 years ago
|
||
Comment 4•17 years ago
|
||
Yep, this patch makes the testcases for those three bugs (plus bug 352907) be compilation errors, so there's no decompilation to get wrong.
Updated•17 years ago
|
Attachment #295157 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 5•17 years ago
|
||
Fixed:
js/src/js.msg 3.82
js/src/jsemit.h 3.87
js/src/jsopcode.c 3.278
js/src/jsparse.c 3.321
js/src/jsscan.c 3.144
/be
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 6•17 years ago
|
||
(In reply to comment #1)
> Want to get this in and shake the trees for anything it might break (I would be
> surprised, but not stunned...).
Glad you got this in now, as there are definite regressions from it (such as bug 410894). :)
Comment 7•17 years ago
|
||
The following now fail with SyntaxError: let declaration not directly within block:
js1_7/block/regress-349298.js
js1_7/block/regress-350730.js
js1_7/block/regress-352092.js
js1_7/block/regress-352185.js
js1_7/decompilation/regress-351070-01.js
js1_7/decompilation/regress-351070-03.js
js1_7/decompilation/regress-352217.js
js1_7/decompilation/regress-352268.js
js1_7/decompilation/regress-352732.js
js1_7/decompilation/regress-356247.js
js1_7/extensions/regress-351070-02.js
what is the best way to handle this? rewrite using eval to catch the SyntaxError on the trunk or rewrite to put let in explicit {} or just note them as known errors on the trunk.
Assignee | ||
Comment 8•17 years ago
|
||
bclary, not sure wht you prefer -- we should test for SyntaxError (message detail is not important, but exception type is), so I favor try{eval(s)}catch(e){...}.
/be
Comment 9•17 years ago
|
||
Is the pattern
for each (let v in a) {
}
legal now?
We have many uses of let in the tree which follow this pattern, see http://mxr.mozilla.org/mozilla/search?string=let+&find=\.js%24&findi=&filter=&tree=mozilla
Assignee | ||
Comment 10•17 years ago
|
||
(In reply to comment #9)
> Is the pattern
>
> for each (let v in a) {
> }
>
> legal now?
Yes, that is not going away of course:
js> function f(){for(let i=0;i<10;i++)print(i)}
js> f()
0
1
2
3
4
5
6
7
8
9
js> function g(){for (let i in this)print(i)}
js> g()
f
g
js> function h(){for each (let i in this)print(i)}
js> h()
function f() {
for (let i = 0; i < 10; i++) {
print(i);
}
}
function g() {
for (let i in this) {
print(i);
}
}
function h() {
for each (let i in this) {
print(i);
}
}
Sorry for not noting the for and for-in exceptions, but testing allays doubt. Still not sure what the specific download.js errors were, but that is for bug 410894...
/be
Comment 11•17 years ago
|
||
This does not cause a syntax error:
js> (function() { for(let x in []) let {} = [1]; })
function () {
for (let x in []) {
let [] = [1];
}
}
Assignee | ||
Comment 12•17 years ago
|
||
(In reply to comment #11)
> This does not cause a syntax error:
>
> js> (function() { for(let x in []) let {} = [1]; })
> function () {
> for (let x in []) {
> let [] = [1];
> }
> }
Followup bug blocking this one to me please. Thanks,
/be
Comment 13•17 years ago
|
||
/cvsroot/mozilla/js/tests/js1_7/block/regress-349298.js,v
new revision: 1.4; previous revision: 1.3
/cvsroot/mozilla/js/tests/js1_7/block/regress-350730.js,v
new revision: 1.4; previous revision: 1.3
/cvsroot/mozilla/js/tests/js1_7/block/regress-352092.js,v
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/js/tests/js1_7/block/regress-352185.js,v
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/js/tests/js1_7/decompilation/regress-351070-01.js,v
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/js/tests/js1_7/decompilation/regress-351070-03.js,v
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/js/tests/js1_7/decompilation/regress-352217.js,v
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/js/tests/js1_7/decompilation/regress-352268.js,v
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/js/tests/js1_7/decompilation/regress-352732.js,v
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/js/tests/js1_7/decompilation/regress-356247.js,v
new revision: 1.3; previous revision: 1.2
/cvsroot/mozilla/js/tests/js1_7/extensions/regress-351070-02.js,v
new revision: 1.3; previous revision: 1.2
Flags: in-testsuite+
Flags: in-litmus-
Comment 14•17 years ago
|
||
account for modified failure message in 1.8 branch
/cvsroot/mozilla/js/tests/public-failures.txt,v <-- public-failures.txt
new revision: 1.19; previous revision: 1.18
Updated•17 years ago
|
Assignee | ||
Updated•17 years ago
|
Summary: let declaration must be direct child of block or top-level implicit block → let declaration must be direct child of block, top-level implicit block, or switch body block
You need to log in
before you can comment on or make changes to this bug.
Description
•