public static List<Variable> getVariables(Function function, boolean localsOnly) {
		if (function == null) {
			throw new NullPointerException("Function may not be null.");
		}

		List<Variable> list = new ArrayList<>();
		if (localsOnly) {
			list.addAll(Arrays.asList(function.getLocalVariables()));
		}
		else {
			list.addAll(Arrays.asList(function.getAllVariables()));
		}

		return list;
	}
Gets all variables for the given function including all parameters and local variables.
@param function The function from which to get the variables
@param localsOnly true signals to return only local variables (not parameters); false
       will return parameters and local variables
@return A list of Variable objects.
@throws NullPointerException if the function is null.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/locationreferences/ReferenceUtils.java