Closed
Bug 10278
Opened 27 years ago
Closed 21 years ago
parser: semicolon is required between two function definitions
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
RESOLVED
FIXED
Future
People
(Reporter: norrisboyd, Assigned: beard)
References
()
Details
Attachments
(1 file)
(deleted),
text/plain
|
Details |
(This bug imported from BugSplat, Netscape's internal bugsystem. It
was known there as bug #99232
http://scopus.netscape.com/bugsplat/show_bug.cgi?id=99232
Imported into Bugzilla on 07/21/99 10:45)
11. eval("function f(){}function g(){}") at top level is an error for JS1.2
and above (missing ; between named function expressions), but declares f
and g as functions below 1.2.
Fails to produce error regardless of version:
js> version(100)
120
js> eval("function f(){}function g(){}")
js> version(120);
100
js> eval("function f(){}function g(){}")
js>
Comment 1•27 years ago
|
||
added a wellTerminated check after functionStmt calls in the top-level parse
function. The code to handle this was in wellTerminated - but it never got
called!
I'm also not sure that this correctly catches function termination for nested
function _statements_ - these seem to only get parsed as functionExprs...
Leaving the bug open for the time being.
Doesn't seem to be in js...
Comment 2•27 years ago
|
||
Added fixes for nested function statements; added similar fixes to jsparse.c.
this causes an error in version 120, but not in 130 or 140. also, in version
140, it does not throw an exceptin.
Comment 4•26 years ago
|
||
Turning on the check turns out to break existing code, so I had to back it out
for the default version. Currently, the check only fires for versions >= 120,
i.e. if the language version is explicitly set to something recent. Actually, I
didn't back it out, some person doing Java development did... so we can't turn
this check on without annoying people.
This is the current behavior I have:
js> eval("function f(){}function g(){}")
js> version(100)
0
js> eval("function f(){}function g(){}")
js> version(110)
100
js> eval("function f(){}function g(){}")
js> version(120)
110
js> eval("function f(){}function g(){}")
Uncaught JavaScript exception:
SyntaxError: 7: missing ; before statement
js> version(130)
120
js> eval("function f(){}function g(){}")
Uncaught JavaScript exception:
SyntaxError: 9: missing ; before statement
js> version(140)
130
js> eval("function f(){}function g(){}")
Uncaught JavaScript exception:
SyntaxError: 11: missing ; before statement
I seem to catch an exeption OK in version 140, are we looking at the same thing?
(I'm working in the SpiderMonkey140_BRANCH in js/src...)
js> try {
eval("function f(){}function g(){}")
} catch (a) {
exn = a;
4;
}
4
js> exn
SyntaxError:16: missing ; before statement
Comment 5•26 years ago
|
||
I've fixed Rhino to match the C engine behavior in this area. This is a place
where compatibility with old code binds us to tolerant behavior for the default
runtime version. An error occurs for versions 1.2 and greater, but not for the
default version.
(Currently this runs into a different bug ( 328816 ) with evalSpecial in rhino,
but I've just twiddled the dynamic version number at which an error is raised,
so I'm confident this fix is unrelated. 328816 can still be reproduced by
setting the dynamic version number to one for which the wellTerminated check
fails.)
Status: RESOLVED → REOPENED
Summary: version check in parser doesn't work → parser: semicolon is required between two function definitions
cloned bug from bugsplat. this is broken in Spider Monkey. fails regardless of
version
Setting all Javacript bugs to rginda QA Contact.
QA Contact: cbegle → rginda
Comment 8•24 years ago
|
||
[SPAM] Marking milestone 'future' as part of nsbeta3 triage.
Target Milestone: --- → Future
Comment 10•24 years ago
|
||
Reassigning Mike's JS Engine bugs to Patrick, as per recent meeting -
Assignee: mike+mozilla → beard
Status: REOPENED → NEW
Comment 11•21 years ago
|
||
How did I miss out on this bug all these years? Fixed, finally, the other month
as part of Narcissus work.
/be
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 12•20 years ago
|
||
jsparse.c 3.94 removed the error for any version.
1.4.3
version(0) - no exception
version(110) - no exception
version(120) - Syntax Error: missing ; before statement
version(130) - ditto
version(140) - ditto
version(150) - ditto
1.7.6
version(0) - no exception
version(110) - no exception
version(120) - no exception
version(130) - no exception
version(140) - no exception
version(150) - no exception
1.8b
version(0) - no exception
version(110) - no exception
version(120) - no exception
version(130) - no exception
version(140) - no exception
version(150) - no exception
invalidates
ecma_2/Exceptions/function-001.js
js1_2/function/function-001-n.js
js1_3/Script/function-001-n.js
I can switch ecma_2/Exceptions/function-001.js to fail if the exception is
thrown, but the other two tests are negative and jsDriver.pl will expect them
to have a non-zero return code. Since they are redundant, I will remove them.
Comment 13•20 years ago
|
||
ditto js1_3/regress/function-001-n.js
Comment 14•20 years ago
|
||
Comment 15•20 years ago
|
||
js1_5/Regress/regress-10278.js checked in.
You need to log in
before you can comment on or make changes to this bug.
Description
•