Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18405] HAL: Create helper functions/macros for typical argument list type checking/casting in js_* bridge methods

GitHub Issuen/a
TypeStory
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-04-06T01:11:01.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsWindows
Labelsn/a
ReporterChristopher Williams
AssigneeKota Iguchi
Created2015-01-19T18:50:16.000+0000
Updated2017-03-16T22:31:13.000+0000

Description

JSValue UIModule::js_createSlider(const std::vector<JSValue>& arguments, JSObject& this_object)
{
	JSObject parameters = get_context().CreateObject();
	if (arguments.size() >= 1) {
		const auto _0 = arguments.at(0);
		TITANIUM_ASSERT(_0.IsObject());
		parameters = _0;
	}
	return createSlider(parameters, this_object);
}
we seem to do this pattern a lot where we pull something out of a argument list, cast it, check the type via assertion, etc. this is a good place to come up with either an inlined helper function or a macro. makes the code more readable and has the advantage for developers to ensure we have a very common pattern for how to do this logic. From Jeff's review comments here: https://github.com/sgtcoolguy/titanium_mobile_windows/commit/c2d07889a2ca6fbb4f689138252003838a42a7e6#commitcomment-9323187

Comments

  1. Kota Iguchi 2015-04-06

    https://github.com/appcelerator/titanium_mobile_windows/pull/202
  2. Lee Morris 2017-03-16

    Closing ticket as fixed.

JSON Source