Closed Bug 726121 Opened 12 years ago Closed 12 years ago

"delete" operator does not evaluate embedded expressions

Categories

(Rhino Graveyard :: Core, defect)

head
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: anba, Unassigned)

Details

Attachments

(1 file)

Attached file Simple JUnit test case
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0
Build ID: 20120129021758

Steps to reproduce:

"delete (bar,baz)" should evaluate the expression "(bar,baz)" before applying the "delete" operator. If either "bar" or "baz" is not defined in the current environment, a ReferenceError should be thrown. 
IRFactory#createUnary(int, Node) simplifies (optimizes?) the "delete" operator to return just "true" instead of evaluating any embedded expression.

Also see bug 508547 for a similar bug report.


Actual results:

"delete (bar,baz)" just returns "true" instead of throwing a ReferenceError


Expected results:

"delete (bar,baz)" needs to throw a ReferenceError. Ouput from SpiderMonkey interacting shell:
---
js> delete (bar,baz)
typein:17: ReferenceError: bar is not defined
---
Thanks for the report. ES5 makes it quite clear that the operand expression always has to be evaluated (step 1 in 11.4.1). Fixed in master and rhino_1_8.

https://github.com/mozilla/rhino/commit/9e3d434569218fc5ae2a14a0241582e7939956c9
Status: UNCONFIRMED → RESOLVED
Closed: 12 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: