public override bool AssignVariable(string name, Node location, AnalysisUnit unit, IAnalysisSet values) { if (name == _name) { // we assign to our copy of the variable var res = AssignVariableWorker(location, unit, values, _variable); // and then assign it to our parent declarative environment so that // it can be read from locations where it's not definitely assigned. EnvironmentRecord declScope = GetDeclarativeEnvironment(); while (declScope.Parent != null && (!declScope.ContainsVariable(name) || declScope is DeclarativeEnvironmentRecord)) { declScope = declScope.Parent; } declScope.AssignVariable(name, location, unit, values); return(res); } return(base.AssignVariable(name, location, unit, values)); }