compute method Null safety

  1. @override
dynamic compute(
  1. SymbolTable? scope
)
override

Implementation

@override
dynamic compute(SymbolTable? scope) {
  switch (name) {
    case 'null':
      return null;
    case 'true':
      return true;
    case 'false':
      return false;
    default:
      var symbol = scope?.resolve(name);
      if (symbol == null) {
        if (scope?.resolve('!strict!')?.value == false) return null;
        throw ArgumentError('The name "$name" does not exist in this scope.');
      }
      return scope?.resolve(name)!.value;
  }
}