示例#1
0
void	CSubtractCommandNode::GenerateCode( CCodeBlock* inCodeBlock )
{
	CValueNode					*	destValue = GetParamAtIndex( 1 );
	CValueNode					*	srcValue = GetParamAtIndex( 0 );
		
	srcValue->GenerateCode( inCodeBlock );
	destValue->GenerateCode( inCodeBlock );
	inCodeBlock->GenerateOperatorInstruction( SUBTRACT_COMMAND_INSTR );
}
void	CAssignCommandNode::GenerateCode( CCodeBlock* inCodeBlock )
{
	CValueNode					*	destValue = GetParamAtIndex( 0 );
	CValueNode					*	srcValue = GetParamAtIndex( 1 );
	CLocalVariableRefValueNode	*	varValue = NULL;
	
	srcValue->GenerateCode( inCodeBlock );
	
	if(( varValue = dynamic_cast<CLocalVariableRefValueNode*>(destValue) ))
		inCodeBlock->GeneratePopIntoVariableInstruction( varValue->GetBPRelativeOffset() );
	else
		throw std::runtime_error("Can't assign to this value.");
}