Skip to content

fix: fix endless recursion during dts generation #2387

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

Merged
merged 2 commits into from
Aug 7, 2022

Conversation

HerrCai0907
Copy link
Member

Fix #2269

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@MaxGraey
Copy link
Member

MaxGraey commented Jul 27, 2022

What about this approach?

let isPlain = this.isPlainObject(clazz);
typeName = `${isPlain ? "__Record" : "__Internref"}${clazz.id}`;
sb.push(typeName);
seenObjectTypes.set(clazz, typeName);
if (isPlain) {
  sb.push(mode == Mode.EXPORT ? "<never>" : "<undefined>");
  this.deferredTypings.push(this.makeRecordType(clazz, mode));
} else {
  this.deferredTypings.push(this.makeInternrefType(clazz));
}

@MaxGraey MaxGraey requested a review from dcodeIO August 7, 2022 04:11
@MaxGraey MaxGraey merged commit 1983883 into AssemblyScript:main Aug 7, 2022
@MaxGraey
Copy link
Member

MaxGraey commented Aug 7, 2022

Thanks!

@HerrCai0907 HerrCai0907 deleted the fix/recursive-class branch August 7, 2022 16:14
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.

Recursive Class | RangeError: Maximum call stack size exceeded
2 participants