Gecko engine for Wine
Go to file
Atul Varma 7d98a5dbeb Added a few log messages to hopefully make the debugging of generators easier. Also added an id component to generators, which is part of their name, to help distinguish between concurrent instances of the same generator function. The following debug output represents the new logging infomation:
--
Async.Generator	DEBUG	 runTestGenerator-0: self.cb generated at test_async_missing_yield.js:28
Async.Generator	DEBUG	 secondGen-1: self.cb generated at test_async_missing_yield.js:20
Async.Generator	DEBUG	 secondGen-1: done() called.
Async.Generator	DEBUG	 runTestGenerator-0: self.cb() called, resuming coroutine.
Async.Generator	DEBUG	 runTestGenerator-0: done() called.
Async.Generator	DEBUG	 secondGen-1: self.cb() called, resuming coroutine.
Async.Generator	DEBUG	 secondGen-1: done() called.
Async.Generator	ERROR	 Async method 'secondGen-1' is missing a 'yield' call (or called done() after being finalized)
--

As you can see, I've added log messages whenever the Generator's 'cb' property is accessed--this is almost guaranteed to be very close to a 'yield' statement, and therefore provides us with a decently accurate idea of where the generator 'stopped'.  We also log a message when the generator continues, and by doing so we get an idea of how the coroutines interleave.

Another idea I had was to actually match calls to self.cb with calls to 'yield' to automatically detect e.g. two yields in a row (which will ordinarily result in a generator 'hanging'), a generator exiting while a self.cb still hasn't been called, but I'm not sure what kinds of reprecussions it may have.
2008-06-11 18:58:30 -07:00
services Added a few log messages to hopefully make the debugging of generators easier. Also added an id component to generators, which is part of their name, to help distinguish between concurrent instances of the same generator function. The following debug output represents the new logging infomation: 2008-06-11 18:58:30 -07:00