Skip to content

Enable debug info when running tests #16310

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 1 commit into from
Jun 8, 2017
Merged

Enable debug info when running tests #16310

merged 1 commit into from
Jun 8, 2017

Conversation

rbuckton
Copy link
Contributor

@rbuckton rbuckton commented Jun 6, 2017

In #16120 I added some additional members to Node, Symbol, and Type that are only available when debugging the compiler. These provide some at-a-glance information about runtime enum values. This change makes them available when debugging tests as well.

@sandersn
Copy link
Member

sandersn commented Jun 6, 2017

Is there a difference between running and debugging tests here? I expect we only want this information when debugging unless it's printed to the output files.

Object.defineProperties(objectAllocator.getTypeConstructor().prototype, {
"__debugFlags": { get(this: Type) { return formatTypeFlags(this.flags); } },
"__debugObjectFlags": { get(this: Type) { return this.flags & TypeFlags.Object ? formatObjectFlags((<ObjectType>this).objectFlags) : ""; } },
"__debugTypeToString": { value(this: Type) { return this.checker.typeToString(this); } },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not this be a getter too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. typeToString performs type checking, which could result in caching resolutions/types/etc. This can be problematic when you are in the middle of debugging a resolution.

Its available as a method as there are cases where you would like to get a view of type while debugging and typeToString is not available as it is not in the environment record of the closure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just wounder how slow it would be to do this on every type when you are debugging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The performance impact so far has been fairly small, as far as my own experience has been, as it only matters when the debugger is paused as that is the only time the watch window performs expression evaluation.

@rbuckton rbuckton merged commit b325790 into master Jun 8, 2017
@rbuckton rbuckton deleted the enableDebugInfo branch June 8, 2017 21:29
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants