Пример #1
0
/*!
 * \brief  Validate primitive and children recursively.
 * \param  inIndex Index of the current primitive.
 * \param  ioContext A reference to the execution context.
 * \return True if valid, false if not.
 */
bool Primitive::isValid(unsigned int inIndex, ExecutionContext& ioContext) const {
	schnaps_StackTraceBeginM();
	std::string lArgReturn, lArgType;
	unsigned int lArgIndex;
	for (unsigned int i = 0; i < mNumberArguments; i++) {
		lArgType = getArgType(inIndex, i, ioContext);
		lArgIndex = getArgumentIndex(inIndex, i, ioContext);
		lArgReturn = ioContext.getPrimitiveTree()[lArgIndex].mPrimitive->getReturnType(inIndex, ioContext);
		if ((lArgType != lArgReturn) && (!ioContext.getSystem().getTypingManager().typeCast(lArgReturn, lArgType))) {
			return false;
		}
	}
	return true;
	schnaps_StackTraceEndM("bool SCHNAPS::Core::Primitive::isValid(unsigned int, SCHNAPS::Core::ExecutionContext&) const");
}