Skip to content

Commit 1141d48

Browse files
committed
[tests] Verify CallMemberVTable with this return
1 parent 41afe5c commit 1141d48

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

test/cppia/Client.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ class Client
224224
default:
225225
}
226226

227+
switch ReturnExpressions.testClientThisReturn() {
228+
case Error(message):
229+
Common.status = 'Failed test for client this return stopping evaluation: ' + message;
230+
return;
231+
default:
232+
}
233+
227234
switch ReturnExpressions.testFuncReturn() {
228235
case Error(message):
229236
Common.status = 'Failed test for function value return stopping evaluation: ' + message;

test/cppia/ReturnExpressions.hx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,22 @@ class ReturnExpressions {
4545
}
4646
return Error("Host method executed after return");
4747
}
48+
49+
function vtableMethod(_) {}
50+
51+
@:analyzer(ignore)
52+
public static function returnAsClientThis() {
53+
// if return is not handled, there is no instance to run the method with
54+
// so this will give a null function exception
55+
(cast return:ReturnExpressions).vtableMethod(Common.incrementCount());
56+
}
57+
58+
public static function testClientThisReturn() {
59+
Common.count = 0;
60+
returnAsClientThis();
61+
if (Common.count == 0) {
62+
return Ok;
63+
}
64+
return Error("Host method executed after return");
65+
}
4866
}

0 commit comments

Comments
 (0)