lib: name EventEmitter prototype methods
authorBen Noordhuis <info@bnoordhuis.nl>
Mon, 5 May 2014 14:48:51 +0000 (16:48 +0200)
committerTrevor Norris <trev.norris@gmail.com>
Wed, 7 May 2014 19:11:57 +0000 (12:11 -0700)
commit17fbdc18b8cec0b6b2827d9e3c6360b694e6e9c3
tree2a865ae866b1fe35d294e2ccf16861c4ee74814e
parent120f7cf55fb977a145dca0ed840ea5a07730da05
lib: name EventEmitter prototype methods

Before this commit the EventEmitter methods were anonymous functions.
V8 tries to infer names for anonymous functions based on the execution
context but it frequently gets it wrong and when that happens, the
stack trace is usually confusing and unhelpful.  This commit names all
methods so V8 can fall back to the method.name property.

The above gotcha applies to all anonymous functions but is exacerbated
for EventEmitter methods because those are invoked with a plenitude of
different receivers.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
lib/events.js
test/message/stdin_messages.out
test/simple/test-event-emitter-method-names.js [new file with mode: 0644]