Merge remote-tracking branch 'origin/GP-0_ghidragon_fixing_junit_failures_related_to_AddressEvaluator'

This commit is contained in:
Ryan Kurtz 2025-01-03 11:38:31 -05:00
commit 18ef5ceea3
3 changed files with 15 additions and 3 deletions

View file

@ -197,6 +197,14 @@ public class AddressInput extends JPanel implements FocusableEditor {
}
}
/**
* Sets the selected AddressSpace to the given space.
* @param addressSpace the address space to set selected
*/
public void setAddressSpace(AddressSpace addressSpace) {
addressSpaceField.setAddressSpace(addressSpace);
}
/**
* Returns the address in the field or null if the address can't
* be parsed.
@ -577,4 +585,5 @@ public class AddressInput extends JPanel implements FocusableEditor {
return model;
}
}
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -435,6 +435,9 @@ public abstract class AbstractSymbolTreePluginExternalsTest
createDialog.getComponent().getRootPane(), EditExternalLocationPanel.class);
AddressInput extAddressInputWidget =
(AddressInput) getInstanceField("extAddressInputWidget", extLocPanel);
extAddressInputWidget.setAddressSpace(addressSpace);
extAddressInputWidget.setText(address);
if (extAddressInputWidget.containsAddressSpaces()) {
JComboBox<?> addressSpaceWidget =
(JComboBox<?>) getInstanceField("combo", extAddressInputWidget);

View file

@ -71,7 +71,7 @@ public class AddressEvaluator extends ExpressionEvaluator {
public static Address evaluate(Program p, Address baseAddr, String inputExpression) {
AddressEvaluator evaluator = new AddressEvaluator(p, true);
try {
return evaluator.parseAsAddress(inputExpression);
return evaluator.parseAsRelativeAddress(inputExpression, baseAddr);
}
catch (ExpressionException e) {
return null;