Employ some variadic macros to make some of the C++ -> JS function calling code nicer.

Template-ize CallFunctionVoid.
Changes CallFunction parameter order to make template parameter
deduction with
variadic parameters work nicely.

Reviewed By: Itms, wraitii, Yves
Differential Revision: https://code.wildfiregames.com/D77
This was SVN commit r19183.
This commit is contained in:
leper
2017-01-28 23:37:15 +00:00
parent fd5bd8e301
commit 6ae2db53db
11 changed files with 158 additions and 258 deletions
@@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -170,7 +170,7 @@ public:
TS_ASSERT_EQUALS(4, nbr);
// CallFunction const JS::RootedValue& parameter overload
script.CallFunction(val, "add", nbrVal, nbr);
script.CallFunction(val, "add", nbr, nbrVal);
TS_ASSERT_EQUALS(7, nbr);
// GetProperty JS::RootedValue* overload
@@ -202,7 +202,7 @@ public:
TS_ASSERT_EQUALS(4, nbr);
// CallFunction const JS::HandleValue& parameter overload
script.CallFunction(val, "add", nbrVal, nbr);
script.CallFunction(val, "add", nbr, nbrVal);
TS_ASSERT_EQUALS(7, nbr);
// GetProperty JS::MutableHandleValue overload