[vm/ffi] Fix multitests in function_callbacks_test and update raw_object_fields.cc

Change-Id: Idb969f9d3cdd58fde02e1e9fab5cbfdf7c09f1ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107507
Reviewed-by: Samir Jindel <sjindel@google.com>
This commit is contained in:
Samir Jindel 2019-06-27 21:44:42 +00:00
parent af506eb45e
commit db3135ab9d
2 changed files with 7 additions and 5 deletions

View file

@ -200,6 +200,7 @@ namespace dart {
F(FfiTrampolineData, signature_type_) \
F(FfiTrampolineData, c_signature_) \
F(FfiTrampolineData, callback_target_) \
F(FfiTrampolineData, callback_exceptional_return_) \
F(TypedDataBase, data_) \
F(TypedDataBase, length_) \
F(TypedDataView, typed_data_) \

View file

@ -222,17 +222,18 @@ testCallbackWrongIsolate() async {
// Correct type of exceptionalReturn argument to fromFunction.
double testExceptionalReturn() {
fromFunction<Double Function()>(testExceptionalReturn, 0.0); //# 60: ok
fromFunction<Void Function()>(returnVoid, 0); //# 63: runtime error
fromFunction<Void Function()>(returnVoid, null); //# 65: ok
fromFunction<Double Function()>(returnVoid, null); //# 64: runtime error
fromFunction<Double Function()>(testExceptionalReturn, 0.0);
Expect.throwsArgumentError(() => fromFunction<Void Function()>(returnVoid, 0));
fromFunction<Void Function()>(returnVoid, null);
Expect.throwsArgumentError(() => fromFunction<Double Function()>(returnVoid, null));
fromFunction<Double Function()>(testExceptionalReturn, "abc"); //# 61: compile-time error
fromFunction<Double Function()>(testExceptionalReturn, 0); //# 62: compile-time error
}
void main() async {
testcases.forEach((t) => t.run()); //# 00: ok
testExceptionalReturn();
testExceptionalReturn(); //# 00: ok
// These tests terminate the process after successful completion, so we have
// to run them separately.