Fix an assetion in `function` variable scanner.