-
-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[hl] hlopt rework try-catch control flow (#11581)
- Loading branch information
Showing
3 changed files
with
97 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package unit.issues; | ||
|
||
private function doThrow() { | ||
throw "from doThrow"; | ||
} | ||
|
||
class Issue11466 extends unit.Test { | ||
var b = 10; | ||
function test() { | ||
var x = 0; | ||
try { | ||
x = b; | ||
throw ''; | ||
} catch(_) { | ||
x += 1; | ||
} | ||
eq(11, x); | ||
} | ||
|
||
function test2() { | ||
var x = 0; | ||
try { | ||
x = b; | ||
doThrow(); | ||
} catch(_) { | ||
x += 1; | ||
} | ||
eq(11, x); | ||
} | ||
} |
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,37 @@ | ||
package unit.issues; | ||
|
||
private function doThrow() { | ||
throw "from doThrow"; | ||
} | ||
|
||
class Issue9174 extends unit.Test { | ||
function test() { | ||
var value = ""; | ||
try { | ||
try { | ||
throw "from throw"; | ||
} catch (e:String) { | ||
value += "inner catch"; | ||
throw e; | ||
} | ||
} catch (e:String) { | ||
value += ", outer catch, " + e; | ||
} | ||
eq("inner catch, outer catch, from throw", value); | ||
} | ||
|
||
function test2() { | ||
var value = ""; | ||
try { | ||
try { | ||
doThrow(); | ||
} catch (e:String) { | ||
value += "inner catch"; | ||
throw e; | ||
} | ||
} catch (e:String) { | ||
value += ", outer catch, " + e; | ||
} | ||
eq("inner catch, outer catch, from doThrow", value); | ||
} | ||
} |