WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
23037
Parsing and reparsing disagree on automatic semicolon insertion
https://bugs.webkit.org/show_bug.cgi?id=23037
Summary
Parsing and reparsing disagree on automatic semicolon insertion
Cameron Zwarich (cpst)
Reported
2008-12-30 11:28:16 PST
Parsing and reparsing disagree about automatic semicolon insertion, so that a function like function() { a = 1, } is parsed as being syntactically valid but gets a syntax error upon reparsing. This leads to an assertion failure in Parser::reparse(). It is not that big of an issue in practice, because in a release build such a function will return 'undefined' when called. Other browsers would throw a syntax error, and there aren't many people who write incorrect JS like this and only check their sites with WebKit. In this case, we are not following the spec and it should be a syntax error. However, unless there is a newline separating the ',' and the '}', JavaScriptCore would never treat it as a syntax error in the past either. It will be a bit of work to make our automatic semicolon insertion match the spec, so I am just going to match our past behaviour.
Attachments
Proposed patch
(8.05 KB, patch)
2008-12-30 11:35 PST
,
Cameron Zwarich (cpst)
sam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Cameron Zwarich (cpst)
Comment 1
2008-12-30 11:29:10 PST
<
rdar://problem/6467124
>
Cameron Zwarich (cpst)
Comment 2
2008-12-30 11:35:42 PST
Created
attachment 26314
[details]
Proposed patch
Darin Adler
Comment 3
2008-12-30 12:10:01 PST
Comment on
attachment 26314
[details]
Proposed patch I don't think that "during reparsing" is a good name for a boolean. I think that "is reparsing" would be better, or possibly "is reparsing underway". I don't see any code setting m_duringReparsing back to false. How can subsequent parsing possibly work properly?
Sam Weinig
Comment 4
2008-12-30 13:01:48 PST
It is reset in Lexer::clear()
Cameron Zwarich (cpst)
Comment 5
2008-12-30 15:36:19 PST
(In reply to
comment #3
)
> (From update of
attachment 26314
[details]
[review]) > I don't think that "during reparsing" is a good name for a boolean. I think > that "is reparsing" would be better, or possibly "is reparsing underway".
I had it like that originally, and it seemed awkward. I'll change it back.
> I don't see any code setting m_duringReparsing back to false. How can > subsequent parsing possibly work properly?
Like Sam said, it is reset during clear().
Cameron Zwarich (cpst)
Comment 6
2008-12-30 16:10:35 PST
Landed in
r39521
with Darin's comment.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug