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)

All
Windows NT
defect

Tracking

()

RESOLVED FIXED
Future

People

(Reporter: norrisboyd, Assigned: beard)

References

()

Details

Attachments

(1 file)

(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>
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...
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.
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
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
QA Contact: cbegle
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
[SPAM] Marking milestone 'future' as part of nsbeta3 triage.
Target Milestone: --- → Future
Updating QA contact -
QA Contact: rginda → pschwartau
Reassigning Mike's JS Engine bugs to Patrick, as per recent meeting -
Assignee: mike+mozilla → beard
Status: REOPENED → NEW
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
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.
ditto js1_3/regress/function-001-n.js
js1_5/Regress/regress-10278.js checked in.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: