Variable[] getStackVariables() {
		StackComponentWrapper[] definedComponents = getDefinedComponents();
		Variable[] vars = new Variable[definedComponents.length];
		for (int i = 0; i < vars.length; i++) {
			StackComponentWrapper dtc = definedComponents[i];
			String fieldName = dtc.getFieldName();
			VariableStorage storage = dtc.getVariableStorage();
			try {
				vars[i] = new LocalVariableImpl(fieldName, 0, dtc.getDataType(), storage,
					function.getProgram());
			}
			catch (InvalidInputException e) {
				try {
					vars[i] =
						new LocalVariableImpl(fieldName, 0, null, storage, function.getProgram());
				}
				catch (InvalidInputException e1) {
					throw new AssertException(); // Unexpected
				}
			}
			vars[i].setComment(dtc.getComment());
		}
		return vars;
	}
{@return newly generated stack variables based on the current state}
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackFrameDataType.java