mirror of https://github.com/lukechilds/rollup.git
Browse Source
Make optimization for if statements with false conditions not break generated codelegacy-quote-reserved-properties
Rich Harris
8 years ago
committed by
GitHub
3 changed files with 74 additions and 3 deletions
@ -0,0 +1,3 @@ |
|||||
|
module.exports = { |
||||
|
description: 'if statements with false condition do not break render (#973)' |
||||
|
}; |
@ -0,0 +1,47 @@ |
|||||
|
export function whileIf(x) { |
||||
|
while (x) |
||||
|
if (false) |
||||
|
// replaced with {}
|
||||
|
x = 0; |
||||
|
} |
||||
|
|
||||
|
export function whileBlockIf(x) { |
||||
|
while (x) { |
||||
|
if (false) |
||||
|
// removed
|
||||
|
x = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function ifWhile(x) { |
||||
|
if (x) |
||||
|
while (false) |
||||
|
// not optimized
|
||||
|
x = 0; |
||||
|
} |
||||
|
|
||||
|
export function ifFalseElse(x) { |
||||
|
if (false) { |
||||
|
// removed
|
||||
|
} else { |
||||
|
// kept
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function elseIfFalse(x) { |
||||
|
if (x) { |
||||
|
// kept
|
||||
|
} else if (false) { |
||||
|
// replaced with {}
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export function elseIfFalseElse(x) { |
||||
|
if (x) { |
||||
|
// kept
|
||||
|
} else if (false) { |
||||
|
// removed
|
||||
|
} else { |
||||
|
// kept
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue