public static void MakeArray(MemoryBlock memory, AsquellObj to, params AsquellObj[] values) { if (to.Type == AsquellObjectType.RunTimeValue) { ArrayObj array = new ArrayObj(values); memory.ModifyVariable(to, array.BaseObj); return; } throw new ArgumentException("Invalid type for modifying memory! First argument must be a variable!"); }
public static void PowerNumbers(MemoryBlock memory, AsquellObj a, AsquellObj b, AsquellObj storeResult) { NumericObj NumA = getNumericObj(a, memory); NumericObj NumB = getNumericObj(b, memory); if (NumA != null && NumB != null) { memory.ModifyVariable(storeResult, (NumA ^ NumB).BaseObj); return; } throw new ArgumentException("Invalid type for power!"); }
public static void MoveMemory(MemoryBlock memory, AsquellObj to, AsquellObj from) { if (from.Type == AsquellObjectType.RunTimeValue) { if (memory.VariableInMemory(from)) { AsquellObj rawValue = memory.GetRealVariable(from); memory.ModifyVariable(to, rawValue); memory.DeleteVariable(from); return; } else { throw new KeyNotFoundException("Can not find '"+from.Value.ToString()+"' in memory!"); } } throw new ArgumentException("Invalid type for moving memory! First argument must be a variable!"); }
public static void SetMemory(MemoryBlock memory, AsquellObj to, AsquellObj from) { memory.ModifyVariable(to, from); }