Closed Bug 590766 Opened 14 years ago Closed 14 years ago

"Assertion failure: PN_TYPE(pn) == TOK_NAME || PN_TYPE(pn) == TOK_ASSIGN" with Reflect.parse, let-block

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: dherman)

References

Details

(Keywords: assertion, testcase, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

Reflect.parse("let(x) { }")
Assertion failure: PN_TYPE(pn) == TOK_NAME || PN_TYPE(pn) == TOK_ASSIGN, at ../jsreflect.cpp:1518
Blocks: 590820
What an oversight! I didn't implement let-expressions or let-statements. This patch implements them and adds tests for them.

(These crashing tests are exactly why I wanted LOCAL_ASSERT instead of JS_ASSERT as much as possible. After addressing the lion's share of these crashers, I will want to do a review of all the JS_ASSERT's and catch-all (else/default) branches that could be making unsound assumptions, and possibly replace them with dynamic checks that aren't disabled in production.)

Dave
Assignee: general → dherman
Added let-statements and let-expressions to the docs:

    https://developer.mozilla.org/en/SpiderMonkey/Parser_API

Dave
Attachment #469347 - Flags: review?(cdleary)
Comment on attachment 469347 [details] [diff] [review]
implements let expressions and let statements

Looks good, just prefer JS_ALWAYS_TRUE(expr) to (void)expr when you do things like reserve up front.

Maybe also try a test for recursive let-expressions? Don't think there's any special corner case there, but it'd be nice to have that covered.
Attachment #469347 - Flags: review?(cdleary) → review+
> Looks good, just prefer JS_ALWAYS_TRUE(expr) to (void)expr when you do things
> like reserve up front.
> 
> Maybe also try a test for recursive let-expressions? Don't think there's any
> special corner case there, but it'd be nice to have that covered.

Sorry, I forgot to address these before I pushed. I'll add them to the patch for bug 590772.

Dave
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/e05e8e974c6a
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: