Example #1
0
 private static void RequierArg <T>(W_Type[] source, int index) where T : W_Type
 {
     if (index >= source.Length)
     {
         throw new Exception("Missing arguments");
     }
     if (!(source[index] is T))
     {
         source[index].Error("Expected argument of type {0} instead saw {1}", W_Type.GetName <T>(), source[index].TypeName);
     }
 }
Example #2
0
 private static void RequireIntArg(W_Type[] source, int index)
 {
     if (index >= source.Length)
     {
         throw new Exception("Missing arguments");
     }
     if (!(source[index] is W_Number))
     {
         source[index].Error("Expected argument of type {0} instead saw {1}", W_Type.GetName <W_Number>(), source[index].TypeName);
     }
     if (Math.Floor(source[index].Number) != source[index].Number)
     {
         source[index].Error("Expected a number with no decimal places");
     }
 }