void ParseVarset(ScopeGroup getter, ScopeGroup scope, VarSetNode varSetNode) { var varSetData = new ParseExpressionTree(this, getter, scope, varSetNode.Variable); if (!(varSetData.ResultingVariable is IndexedVar)) { throw SyntaxErrorException.VariableIsReadonly(varSetData.ResultingVariable.Name, varSetNode.Location); } IndexedVar variable = (IndexedVar)varSetData.ResultingVariable; Element[] index = varSetData.VariableIndex; Element value = null; if (varSetNode.Value != null) { value = ParseExpression(getter, scope, varSetNode.Value); } Element initialVar = variable.GetVariable(varSetData.Target); Operation?operation = null; switch (varSetNode.Operation) { case "+=": operation = Operation.Add; break; case "-=": operation = Operation.Subtract; break; case "*=": operation = Operation.Multiply; break; case "/=": operation = Operation.Divide; break; case "^=": operation = Operation.RaiseToPower; break; case "%=": operation = Operation.Modulo; break; case "++": operation = Operation.Add; value = 1; break; case "--": operation = Operation.Subtract; value = 1; break; } if (operation == null) { Actions.AddRange(variable.SetVariable(value, varSetData.Target, index)); } else { Actions.AddRange(variable.ModifyVariable((Operation)operation, value, varSetData.Target, index)); } }