Skip to content

if/else flattening in if branch #165

@Le0Developer

Description

@Le0Developer

webcrack is able to successfully flatten if/else nesting in the else branch:

if(cond) {
  console.log("branch 1")
} else {
  if(cond2) {
    console.log("branch 2")
  } else {
    console.log("branch 3")
  }
}

becomes

if (cond) {
  console.log("branch 1");
} else if (cond2) {
  console.log("branch 2");
} else {
  console.log("branch 3");
}

but the inverse is not unflattened:

if (!cond) {
  if (cond2) {
    console.log("branch 2");
  } else {
    console.log("branch 3");
  }
} else {
  console.log("branch 1");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions