MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / ReturnMove

Method ReturnMove

source/script_object.cpp:1714–1737  ·  view source on GitHub ↗

Return value, knowing Variant will shortly be deleted. Value may be moved from Variant into ResultToken.

Source from the content-addressed store, hash-verified

1712// Return value, knowing Variant will shortly be deleted.
1713// Value may be moved from Variant into ResultToken.
1714void Object::Variant::ReturnMove(ResultToken &result)
1715{
1716 switch (result.symbol = symbol)
1717 {
1718 case SYM_STRING:
1719 // For simplicity, just discard the memory of item.string (can't return it as-is since
1720 // the string isn't at the start of its memory block). Scripts can use the 2-param mode
1721 // to avoid any performance penalty this may incur.
1722 TokenSetResult(result, string, string.Length());
1723 break;
1724 case SYM_OBJECT:
1725 result.object = object;
1726 Minit(); // Let item forget the object ref since we are taking ownership.
1727 break;
1728 case SYM_MISSING:
1729 case SYM_DYNAMIC:
1730 result.SetValue(_T(""), 0);
1731 break;
1732 //case SYM_INTEGER:
1733 //case SYM_FLOAT:
1734 default:
1735 result.value_int64 = n_int64; // Effectively also value_double = n_double.
1736 }
1737}
1738
1739// Used when we want the value as is, in a token. Does not AddRef() or copy strings.
1740void Object::Variant::ToToken(ExprTokenType &aToken)

Callers 3

DeletePropMethod · 0.80
DeleteMethod · 0.80
InvokeMethod · 0.80

Calls 3

TokenSetResultFunction · 0.85
SetValueMethod · 0.80
LengthMethod · 0.45

Tested by

no test coverage detected