Exemple #1
0
 public void Push(Value value)
 {
     if (this.length == this.storage.Length) {
         Array.Resize (ref this.storage, this.storage.Length * 2);
     }
     this.storage [this.length] = value;
     this.length++;
 }
Exemple #2
0
 public static Value GetStructInstanceValue(StructInstance str, string key, Value defaultValue)
 {
     for (int i = 0; i < str.Struct.Fields.Length; i++) {
         if (str.Struct.Fields[i] == key) {
             return str.Values[i];
         }
     }
     return defaultValue;
 }
Exemple #3
0
 public static bool SetStructInstanceValue(StructInstance str, string key, Value newValue)
 {
     for (int i = 0; i < str.Struct.Fields.Length; i++) {
         if (str.Struct.Fields[i] == key) {
             str.Values[i] = newValue;
             return true;
         }
     }
     return false;
 }
Exemple #4
0
 public Value[] GetUsedStack()
 {
     var result = new Value[this.length];
     Array.Copy (this.storage, result, this.length);
     return result;
 }
Exemple #5
0
 public void GetTopRange(int n, out Value[] array, out int start)
 {
     array = this.storage;
     start = this.length - n;
 }
Exemple #6
0
 public Stack(Value[] existingValues)
 {
     this.storage = new Value[existingValues.Length * 2];
     this.length = existingValues.Length;
     Array.Copy (existingValues, this.storage, this.length);
 }