Example #1
0
 public Value VerifyType <T>(SourceRef location)
 {
     if ((Object == null || !(Object is T)) && Type != ValueType.Nil)
     {
         throw new UnexpectedTypeException(DynamicValue?.GetType(), typeof(T), location);
     }
     return(this);
 }
Example #2
0
 public Value VerifyType <T>(
     [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath  = "",
     [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0
     )
 {
     if ((Object == null || !(Object is T)) && Type != ValueType.Nil)
     {
         throw new UnexpectedTypeException(
                   DynamicValue?.GetType(),
                   typeof(T),
                   new SourceRef(
                       new Source(sourceFilePath, ""),
                       sourceLineNumber,
                       0
                       )
                   );
     }
     return(this);
 }