Skip to content

Commit cb6b669

Browse files
committed
[tests] Verify CallHaxe BCR after each arg
1 parent 44f74ec commit cb6b669

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

test/cppia/Client.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ class Client
217217
default:
218218
}
219219

220+
switch ReturnExpressions.testHostArgReturn() {
221+
case Error(message):
222+
Common.status = 'Failed test for argument return stopping argument evaluation: ' + message;
223+
return;
224+
default:
225+
}
226+
220227
// regression test for #926
221228
var x:Dynamic = 3;
222229
x *= 5;

test/cppia/Common.hx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ class Common
1313
return count++;
1414
}
1515

16+
public function new() {}
17+
1618
public function dummyMethod() {}
1719
public function dummyMethodArg(_) {}
20+
21+
public function instanceIncrementCount(_) {
22+
count++;
23+
}
1824
}

test/cppia/ReturnExpressions.hx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,18 @@ class ReturnExpressions {
1515
}
1616
return Error("Host method executed after return");
1717
}
18+
19+
@:analyzer(ignore)
20+
static function returnAsCallHaxeArg() {
21+
new Common().instanceIncrementCount(return);
22+
}
23+
24+
public static function testHostArgReturn() {
25+
Common.count = 0;
26+
returnAsCallHaxeArg();
27+
if (Common.count == 0) {
28+
return Ok;
29+
}
30+
return Error("Host method executed after return");
31+
}
1832
}

0 commit comments

Comments
 (0)