public static void SetCorrectColumn(List<Variable> refVar, Statement.StatementType type, int line) { if (refVar == null) return; if (type != Statement.StatementType.Expression) { foreach (Variable singleVar in refVar) singleVar.MoveColumnBack(line); } }
/// <summary> /// Returns the names of the variables that have been declared in the statement /// </summary> /// <param name="s"> Statement whose variable names to be got.</param> /// <param name="onlyTopLevel"> Bool to check if required to return reference variables in sub statements as well</param> /// <returns></returns> public static List<string> GetDefinedVariableNames(Statement s, bool onlyTopLevel) { var names = s.definedVariables.Select(refVar => refVar.Name).ToList(); if (!onlyTopLevel) { foreach (Statement subStatement in s.subStatements) names.AddRange(GetReferencedVariableNames(subStatement, onlyTopLevel)); } return names; }