Exemplo n.º 1
0
 public static EcmaValue BigIntLiteral(string str)
 {
     Guard.ArgumentNotNull(str, "str");
     if (str.Length == 0)
     {
         throw new ArgumentException("Literal cannot be empty", "str");
     }
     if (str[str.Length - 1] == 'n')
     {
         str = str.Substring(0, str.Length - 1);
     }
     // negative non-decimal is not valid BigInt string (error thrown when passed to BigInt constructor)
     // but included here as text like -0xfn can produce intended value
     if (str[0] == '-')
     {
         return(-BigIntHelper.ToBigInt(str.Substring(1)));
     }
     return(BigIntHelper.ToBigInt(str));
 }
Exemplo n.º 2
0
 public static EcmaValue BigIntLiteral(long value)
 {
     return(BigIntHelper.ToBigInt(value));
 }