Add getVariableInstances method to VariableScopeImpl.