Skip to content

Commit c9abb59

Browse files
committed
node: make AsyncListenerInst field more explicit
"flags" could mean one of many things, and multiple flag types could be checked. So make the field more explicit on what type of flags are being stored. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
1 parent 1d2fab3 commit c9abb59

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/node.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@
351351
for (i = 0; i < ccQueue.length; i++) {
352352
queueItem = ccQueue[i];
353353
queue[queue.length] = queueItem;
354-
if ((queueItem.flags & HAS_CREATE_AL) === 0) {
354+
if ((queueItem.callback_flags & HAS_CREATE_AL) === 0) {
355355
data[queueItem.uid] = queueItem.data;
356356
continue;
357357
}
@@ -369,8 +369,8 @@
369369
if (data[queueItem.uid] !== undefined)
370370
continue;
371371
queue[queue.length] = queueItem;
372-
context._asyncFlags |= queueItem.flags;
373-
if ((queueItem.flags & HAS_CREATE_AL) === 0) {
372+
context._asyncFlags |= queueItem.callback_flags;
373+
if ((queueItem.callback_flags & HAS_CREATE_AL) === 0) {
374374
data[queueItem.uid] = queueItem.data;
375375
continue;
376376
}
@@ -397,7 +397,7 @@
397397
inAsyncTick = true;
398398
for (i = 0; i < queue.length; i++) {
399399
queueItem = queue[i];
400-
if ((queueItem.flags & HAS_BEFORE_AL) > 0)
400+
if ((queueItem.callback_flags & HAS_BEFORE_AL) > 0)
401401
queueItem.before(context, data[queueItem.uid]);
402402
}
403403
inAsyncTick = false;
@@ -418,7 +418,7 @@
418418
inAsyncTick = true;
419419
for (i = 0; i < queue.length; i++) {
420420
queueItem = queue[i];
421-
if ((queueItem.flags & HAS_AFTER_AL) > 0)
421+
if ((queueItem.callback_flags & HAS_AFTER_AL) > 0)
422422
queueItem.after(context, data[queueItem.uid]);
423423
}
424424
inAsyncTick = false;
@@ -445,7 +445,7 @@
445445
var data = currentContext._asyncData;
446446
for (i = 0; i < queue.length; i++) {
447447
queueItem = queue[i];
448-
if ((queueItem.flags & HAS_ERROR_AL) === 0)
448+
if ((queueItem.callback_flags & HAS_ERROR_AL) === 0)
449449
continue;
450450
try {
451451
threw = true;
@@ -469,7 +469,7 @@
469469
if (asyncQueue) {
470470
for (i = 0; i < asyncQueue.length; i++) {
471471
queueItem = asyncQueue[i];
472-
if ((queueItem.flags & HAS_ERROR_AL) === 0 ||
472+
if ((queueItem.callback_flags & HAS_ERROR_AL) === 0 ||
473473
(data && data[queueItem.uid] !== undefined))
474474
continue;
475475
try {
@@ -501,19 +501,19 @@
501501
function AsyncListenerInst(callbacks, data) {
502502
if (typeof callbacks.create === 'function') {
503503
this.create = callbacks.create;
504-
this.flags |= HAS_CREATE_AL;
504+
this.callback_flags |= HAS_CREATE_AL;
505505
}
506506
if (typeof callbacks.before === 'function') {
507507
this.before = callbacks.before;
508-
this.flags |= HAS_BEFORE_AL;
508+
this.callback_flags |= HAS_BEFORE_AL;
509509
}
510510
if (typeof callbacks.after === 'function') {
511511
this.after = callbacks.after;
512-
this.flags |= HAS_AFTER_AL;
512+
this.callback_flags |= HAS_AFTER_AL;
513513
}
514514
if (typeof callbacks.error === 'function') {
515515
this.error = callbacks.error;
516-
this.flags |= HAS_ERROR_AL;
516+
this.callback_flags |= HAS_ERROR_AL;
517517
}
518518

519519
this.uid = ++alUid;
@@ -525,7 +525,7 @@
525525
AsyncListenerInst.prototype.error = undefined;
526526
AsyncListenerInst.prototype.data = undefined;
527527
AsyncListenerInst.prototype.uid = 0;
528-
AsyncListenerInst.prototype.flags = 0;
528+
AsyncListenerInst.prototype.callback_flags = 0;
529529

530530
// Create new async listener object. Useful when instantiating a new
531531
// object and want the listener instance, but not add it to the stack.

0 commit comments

Comments
 (0)