.NAME Exception in exception

.DESCRIPTION
	The assignment-expression of a throw statement shall 
not itself cause an exception to be thrown. 

.COMMENT V7.0

.SEVERITY Required

.REQUIRED cpp_semantic

.COMMENT
Please refer to the MISRA C++:2008 document for further details (www.misra-cpp.com)

.COMMAND tcl

.CODE

::logiscope::include -once common utilities.tcl

proc compute {standardName tree} {
  variable CurrentParameterList
  # Check all throw nodes
  utilities::filterTree $tree [list [namespace current]::check]
}

proc check {node} {
	#If the node is throw verify assignment expression
	if {[::utilities::isTreeOperator $node throw]} {
		set thrown [::logiscope::treeGetSon $node SIMPLE_EXPR_OPT]
		#Check if the assignment expression is either call or new
		switch -- [::utilities::treeOperatorName $thrown] {
					new - 
					call
			    {
			    	::logiscope::addViolation $node
			    	return 0;
			    }
		  }
	}
	return 1
}
