コード例 #1
0
ファイル: xs6Property.c プロジェクト: kouis3940/kinomajs
txSlot* fxNextHostAccessorProperty(txMachine* the, txSlot* property, txCallback get, txCallback set, txID id, txFlag flag)
{
	txSlot *getter = NULL, *setter = NULL, *home = the->stack, *slot;
	if (get) {
		getter = fxNewHostFunction(the, get, 0, id);
		slot = mxFunctionInstanceHome(getter);
		slot->kind = home->kind;
		slot->value = home->value;
	}
	if (set) {
		setter = fxNewHostFunction(the, set, 1, id);
		slot = mxFunctionInstanceHome(setter);
		slot->kind = home->kind;
		slot->value = home->value;
	}
	property = property->next = fxNewSlot(the);
	property->flag = flag;
	property->ID = id;
	property->kind = XS_ACCESSOR_KIND;
	property->value.accessor.getter = getter;
	property->value.accessor.setter = setter;
	if (set)
		the->stack++;
	if (get)
		the->stack++;
	return property;
}
コード例 #2
0
ファイル: xs6Property.c プロジェクト: kouis3940/kinomajs
txSlot* fxNextHostFunctionProperty(txMachine* the, txSlot* property, txCallback call, txInteger length, txID id, txFlag flag)
{
	txSlot *function, *home = the->stack, *slot;
	function = fxNewHostFunction(the, call, length, id);
	slot = mxFunctionInstanceHome(function);
	slot->kind = home->kind;
	slot->value = home->value;
	property = property->next = fxNewSlot(the);
	property->flag = flag;
	property->ID = id;
	property->kind = the->stack->kind;
	property->value = the->stack->value;
	the->stack++;
	return property;
}
コード例 #3
0
ファイル: xs6All.c プロジェクト: dadongdong/kinomajs
void fxBufferFrameName(txMachine* the, txString buffer, txSize size, txSlot* frame, txString suffix)
{
	txSlot* target = frame + 2; 
	txSlot* function = frame + 3; 
	txSlot* _this = frame + 4;
	if (function->kind == XS_REFERENCE_KIND) {
		function = function->value.reference;
		if (mxIsFunction(function)) {
			if (target->kind == XS_UNDEFINED_KIND) {
				txSlot* home = mxFunctionInstanceHome(function);
				if (home->kind == XS_REFERENCE_KIND) {
					home = home->value.reference;
					if (mxIsFunction(home)) {
						fxBufferFunctionName(the, buffer, size, home, ".");
					}
					else {
						txSlot* constructor = fxGetOwnProperty(the, home, mxID(_constructor));
						if (constructor) {
							if (constructor->kind == XS_REFERENCE_KIND) {
								constructor = constructor->value.reference;
								if (mxIsFunction(constructor))
									fxBufferFunctionName(the, buffer, size, constructor, ".prototype.");
							}
						}
						else if (_this->kind == XS_REFERENCE_KIND) {
							fxBufferObjectName(the, buffer, size, _this->value.reference, ".");
						}
					}
				}
			}
			fxBufferFunctionName(the, buffer, size, function, "");
		}
	}
	else
		c_strncat(buffer, "(host)", size - c_strlen(buffer) - 1);
	c_strncat(buffer, suffix, size - c_strlen(buffer) - 1);
}