specifiedTypeOf method

ResolvedType? specifiedTypeOf(
  1. Variable variable
)

Looks up the defined type for that variable.

Returns null if the type of that variable hasn't been set.

Implementation

ResolvedType? specifiedTypeOf(Variable variable) {
  // colon-named variables also have an index!
  final index = variable.resolvedIndex;
  if (index != null && indexedVariableTypes.containsKey(index)) {
    return indexedVariableTypes[index];
  } else if (variable is ColonNamedVariable) {
    return namedVariableTypes[variable.name];
  }
  return null;
}