Exemple #1
0
 public VMValue_array MakeArray()
 {
     int guid = nextguid++;
     VMValue_array ret = new VMValue_array(guid, -1);
     allValues.Add(guid, ret);
     return ret;
 }
Exemple #2
0
 public override VMValue Duplicate()
 {
     VMValue_array ret = new VMValue_array();
     ret.CopyInternalData(this);
     return ret;
 }
Exemple #3
0
 /// <summary>
 /// Make a new value of the same type of the given value
 /// The given value is not modified after the operation, only its type is used
 /// </summary>
 /// <param name="value">The given value to get the type</param>
 /// <returns>A new value of the same type of the given value</returns>
 public VMValue MakeValue(VMValue value)
 {
     VMValue ret;
     if(value is VMValue_int32)
     {
         ret = new VMValue_int32(nextguid, 0);
         allValues.Add(nextguid, ret);
         nextguid++;
         return ret;
     }
     else if(value is VMValue_int64)
     {
         ret = new VMValue_int64(nextguid, 0);
         allValues.Add(nextguid, ret);
         nextguid++;
         return ret;
     }
     else if(value is VMValue_double)
     {
         ret = new VMValue_double(nextguid, 0);
         allValues.Add(nextguid, ret);
         nextguid++;
         return ret;
     }
     else if(value is VMValue_object)
     {
         ret = new VMValue_object(nextguid, ((VMValue_object)value).ClassType, -1);
         allValues.Add(nextguid, ret);
         nextguid++;
         return ret;
     }
     else if(value is VMValue_array)
     {
         ret = new VMValue_array(nextguid, -1);
         allValues.Add(nextguid, ret);
         nextguid++;
         return ret;
     }
     else
         throw new Exception("Unknown value type to make a value");
 }