Closed Bug 392310 Opened 17 years ago Closed 17 years ago

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

Categories

(Rhino Graveyard :: Core, defect)

1.7R1
x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: norrisboyd, Assigned: norrisboyd)

Details

Attachments

(1 file, 1 obsolete file)

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
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
Closed: 17 years ago
Resolution: --- → FIXED
Attached file js1_7/geniter/regress-392310.js (obsolete) —
Attachment #276798 - Flags: review?(norrisboyd)
Attached file regress-392310.js
Updated proposed test to match Rhino error output.
Attachment #276798 - Attachment is obsolete: true
Attachment #276798 - Flags: review?(norrisboyd)
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.

Attachment

General

Created:
Updated:
Size: