Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol for _destination property #78

Merged
merged 1 commit into from
Jul 31, 2022
Merged

Symbol for _destination property #78

merged 1 commit into from
Jul 31, 2022

Conversation

jacoscaz
Copy link
Collaborator

@jacoscaz jacoscaz commented Jul 30, 2022

This PR complements #63 (which should be merged first) by renaming the _destination property to a dedicated Symbol, guaranteed to be unique, so that we can never trigger property collisions when setting _destination on externally-provided source objects for which isAsyncReadable(source) === true at

AsyncIterator/asynciterator.ts

Lines 2030 to 2043 in 159ed2b

protected _wrapSource(source: InternalSource<T>) {
try {
this._source = isAsyncReadable(source) ? source : fromSource(source);
}
catch (error) {
scheduleTask(() => this.emit('error', error));
return;
}
this._source._destination = this;
this._source.on('end', destinationClose);
this._source.on('error', destinationEmitError);
this._source.on('readable', destinationSetReadable);
this.readable = true;
}
.

@jacoscaz jacoscaz mentioned this pull request Jul 30, 2022
@RubenVerborgh RubenVerborgh self-assigned this Jul 31, 2022
@RubenVerborgh
Copy link
Owner

Thanks, @jacoscaz, I'm happy to take it from here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants