declareVariable method

void declareVariable(
  1. DartBlockArbiter arbiter,
  2. String variableName,
  3. DartBlockDataType dataType,
  4. DartBlockValue? value,
)

Declare a variable using the given name and optionally the initial value.

Implementation

void declareVariable(
  DartBlockArbiter arbiter,
  String variableName,
  DartBlockDataType dataType,
  DartBlockValue? value,
) {
  /// If a variable with the same name is already declared, throw an Error.
  if (getContainingEnvironment(variableName) != null) {
    throw VariableAlreadyDeclaredException(variableName);
  } else {
    _memoryTypes[variableName] = dataType;
    // if (value != null) {
    _assignValue(arbiter, this, variableName, value);
    // }
  }
}