getLocal method

Value? getLocal(
  1. String identifier, [
  2. Value? defaultValue
])

Get the value of a local variable ONLY -- does not check any other scopes, nor check for special built-in identifiers like "globals". Used mainly by host apps to easily look up an argument to an intrinsic function call by the parameter name.

Implementation

Value? getLocal(String identifier, [Value? defaultValue]) {
  var result = ValuePointer<Value>();
  if (variables != null &&
      variables!.tryGetValueWithIdentifier(identifier, result)) {
    return result.value;
  }
  return defaultValue;
}