-
-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also don't unroll loops that have static vars closes #11800
- Loading branch information
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package unit.issues; | ||
|
||
class Issue11800 extends unit.Test { | ||
public function test() { | ||
static var a = 0; // Works. | ||
var buf = new StringBuf(); | ||
function append(v:Int) { | ||
buf.add(Std.string(v)); | ||
} | ||
for (i in 0...3) { | ||
switch i { | ||
case n if (n < 2): | ||
append(++a); | ||
static var b = 0; // Not static. | ||
append(++b); // Always `1`. | ||
case _: | ||
} | ||
} | ||
eq("1122", buf.toString()); | ||
} | ||
} |