Merge remote-tracking branch 'origin/GP-2114_dev747368_Golang--SQUASHED'

This commit is contained in:
Ryan Kurtz 2023-05-01 06:19:11 -04:00
commit aa893f6721
125 changed files with 12264 additions and 1492 deletions

View file

@ -148,6 +148,21 @@
<optional>
<attribute name="piece4"/>
</optional>
<optional>
<attribute name="piece5"/>
</optional>
<optional>
<attribute name="piece6"/>
</optional>
<optional>
<attribute name="piece7"/>
</optional>
<optional>
<attribute name="piece8"/>
</optional>
<optional>
<attribute name="piece9"/>
</optional>
</element>
</define>

View file

@ -233,7 +233,7 @@ public class ParameterImpl extends VariableImpl implements Parameter {
* @throws InvalidInputException if dataType restrictions are violated, an invalid storage
* element is specified, or error while resolving storage element for specified datatype
*/
protected ParameterImpl(String name, int ordinal, DataType dataType, VariableStorage storage,
public ParameterImpl(String name, int ordinal, DataType dataType, VariableStorage storage,
boolean force, Program program, SourceType sourceType) throws InvalidInputException {
this(name, ordinal, dataType, storage, null, null, null, force, program, sourceType);
}

View file

@ -948,6 +948,35 @@ public class SymbolUtilities {
return symType.toString();
}
/**
* Returns the global symbol with the given name if and only if it is the only global symbol
* with that name.
*
* @param program the program to search.
* @param name the name of the global symbol to find.
* @return the global symbol with the given name if and only if it is the only one.
*/
public static Symbol getUniqueSymbol(Program program, String name) {
return getUniqueSymbol(program, name, null);
}
/**
* Returns the symbol in the given namespace with the given name if and only if it is the only
* symbol in that namespace with that name.
*
* @param program the program to search.
* @param name the name of the symbol to find.
* @param namespace the parent namespace; may be null
* @return the symbol with the given name if and only if it is the only one in that namespace
*/
public static Symbol getUniqueSymbol(Program program, String name, Namespace namespace) {
List<Symbol> symbols = program.getSymbolTable().getSymbols(name, namespace);
if (symbols.size() == 1) {
return symbols.get(0);
}
return null;
}
/**
* Returns the unique global label or function symbol with the given name. Also, logs if there
* is not exactly one symbol with that name.