private VariableInfo GetVariableOrDefaultForChild(string name) { VariableInfo variable = Variables.GetValueOrDefault(name) ?? VariablesFromParent.GetValueOrDefault(name) ?? GetGroupVariableOrDefault(name); if (variable == null && Parent?.GetVariableOrDefaultForChild(name) != null) { variable = new VariableInfo { Name = name, Depth = 0, StackLocation = -(OrderedVariablesFromParent.Count + 1) }; VariablesFromParent.Add(name, variable); OrderedVariablesFromParent.Add(variable); } return(variable); }
public VariableInfo GetVariableOrDefault(string name) { VariableInfo variable = Variables.GetValueOrDefault(name) ?? VariablesFromParent.GetValueOrDefault(name); if (variable == null && !(Group?.Pointers.ContainsKey(name) ?? false) && Parent?.GetVariableOrDefaultForChild(name) != null) { variable = new VariableInfo { Name = name, Depth = 0, StackLocation = -(OrderedVariablesFromParent.Count + 1) }; VariablesFromParent.Add(name, variable); OrderedVariablesFromParent.Add(variable); } return(variable); }
private VariableInfo GetGroupVariableOrDefault(string name) { VariableInfo variable = null; if (Group?.Pointers.ContainsKey(name) ?? false) { variable = new VariableInfo { Name = name, Depth = 0, StackLocation = -(OrderedVariablesFromParent.Count + 1), IsFromGroup = true }; VariablesFromParent.Add(name, variable); OrderedVariablesFromParent.Add(variable); } return(variable); }