Skip to content

Commit

Permalink
Show all matching enum flags in debug flag formatter (microsoft#34689)
Browse files Browse the repository at this point in the history
* Show all matching enum flags in debug formatter

* Revert "Show all matching enum flags in debug formatter"

This reverts commit 0730997.

* Same thing but simpler

* Lint
  • Loading branch information
andrewbranch committed Oct 25, 2019
1 parent 88f3593 commit d8840f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/compiler/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ namespace ts {
if (isFlags) {
let result = "";
let remainingFlags = value;
for (let i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
const [enumValue, enumName] = members[i];
if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
for (const [enumValue, enumName] of members) {
if (enumValue > value) {
break;
}
if (enumValue !== 0 && enumValue & value) {
result = `${result}${result ? "|" : ""}${enumName}`;
remainingFlags &= ~enumValue;
result = `${enumName}${result ? "|" : ""}${result}`;
}
}
if (remainingFlags === 0) {
Expand Down

0 comments on commit d8840f8

Please sign in to comment.