@@ -300,12 +300,9 @@ private static boolean isValidUniqueVariable(HighFunction highFunction, Variable
300
300
* database which conflict with this variable and return
301
301
* one of them for re-use. The returned variable still
302
302
* exists within the function at the same first-use-offset.
303
- * @throws InvalidInputException
304
- * @returns variable with conflicting storage or null, all
305
- * aspects of variable returned should be reset (i.e., name, datatype and storage)
303
+ * @returns existing variable with identical storage and first-use offset or null
306
304
*/
307
- private static Variable clearConflictingLocalVariables (HighLocal local )
308
- throws InvalidInputException {
305
+ private static Variable clearConflictingLocalVariables (HighLocal local ) {
309
306
310
307
if (local instanceof HighParam ) {
311
308
throw new IllegalArgumentException ();
@@ -344,10 +341,7 @@ private static Variable clearConflictingLocalVariables(HighLocal local)
344
341
VariableStorage otherStorage = otherVar .getVariableStorage ();
345
342
346
343
if (otherStorage .intersects (storage )) {
347
- if (matchingVariable == null || otherStorage .equals (storage )) {
348
- if (matchingVariable != null ) {
349
- func .removeVariable (matchingVariable );
350
- }
344
+ if (matchingVariable == null && otherStorage .equals (storage )) {
351
345
matchingVariable = otherVar ;
352
346
continue ;
353
347
}
@@ -460,7 +454,7 @@ else if (variable instanceof HighLocal) {
460
454
Variable var = clearConflictingLocalVariables (local );
461
455
if (dataType == null ) {
462
456
if (var != null ) {
463
- dataType = var .getDataType (); // Use preexisting datatype
457
+ dataType = var .getDataType (); // Use preexisting datatype if it fits in desired storage
464
458
}
465
459
else {
466
460
dataType = Undefined .getUndefinedDataType (variable .getSize ());
0 commit comments