send(undefined) on newborn generator shouldn't cause error

RESOLVED FIXED

Status

Rhino
Core
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: Norris Boyd, Assigned: Norris Boyd)

Tracking

Bug Flags:
in-testsuite +

Details

Attachments

(1 attachment, 1 obsolete attachment)

2.82 KB, application/x-javascript
Details
(Assignee)

Description

11 years ago
SpiderMonkey:

js> function yielder() {
  print('before ye yield');
  yield;
  print('after ye yield');
}

js> var gen = yielder();
js> gen.send(undefined);
before ye yield

I.e. (per http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7),
calling send(undefined) on a newborn generator is equivalent to calling
next() to start it.

Rhino:

js> gen.send(undefined)
js: "<stdin>", line 44: uncaught JavaScript runtime exception:
  TypeError: Attempt to send value to newborn generator
(Assignee)

Comment 1

11 years ago
Checking in NativeGenerator.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeGenerator.java,v  <--  NativeGenerator.java
new revision: 1.6; previous revision: 1.5
done
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED

Comment 2

11 years ago
Created attachment 276798 [details]
js1_7/geniter/regress-392310.js
Attachment #276798 - Flags: review?(norrisboyd)
(Assignee)

Comment 3

11 years ago
Created attachment 276827 [details]
regress-392310.js

Updated proposed test to match Rhino error output.
Attachment #276798 - Attachment is obsolete: true
Attachment #276798 - Flags: review?(norrisboyd)

Comment 4

11 years ago
Checking in regress-392310.js;
/cvsroot/mozilla/js/tests/js1_7/geniter/regress-392310.js,v  <--  regress-392310.js
initial revision: 1.1
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.