| | 259 | |
| | 260 | |
| | 261 | ==== There Must Be No ValueOf Operations for Values ==== |
| | 262 | * '''Symbolic Name in XML Configuration''': checkNoValueOfForValues |
| | 263 | * '''Dependant Tags in XML Configuration''': - |
| | 264 | |
| | 265 | This check makes sure there are no '''valueof''' operations on "pure" values. This currently covers references to local variables and formal parameters. |
| | 266 | |
| | 267 | {{{ |
| | 268 | function f_Work() { |
| | 269 | var float v_ToConvert := 2.0; |
| | 270 | var float v_ValueCms; |
| | 271 | var template float v_ToConvertTemplate := 2.0; |
| | 272 | //Being a value already the call to valueof is redundant -> warning |
| | 273 | v_ValueCms := f_ConvertInchesToCm(valueof(v_ToConvert)); |
| | 274 | //Should be ok -> no warning |
| | 275 | v_ValueCms := f_ConvertInchesToCm(valueof(v_ToConvertTemplate)); |
| | 276 | } |
| | 277 | //TODO: further examples with return values, parameters, etc |
| | 278 | |
| | 279 | function f_Work ( |
| | 280 | float p_ToConvert, |
| | 281 | template float p_ToConvertTemplate |
| | 282 | ) return template float { |
| | 283 | var float v_ValueCms; |
| | 284 | //Being a value already the call to valueof is redundant -> warning |
| | 285 | v_ValueCms := f_ConvertInchesToCm(valueof(p_ToConvert)); |
| | 286 | //Should be ok -> no warning |
| | 287 | v_ValueCms := f_ConvertInchesToCm(valueof(p_ToConvertTemplate)); |
| | 288 | } |
| | 289 | }}} |