示例#1
0
 public static EcmaValue GetIntrinsicPrimitiveValue(this EcmaValue thisValue, EcmaValueType type)
 {
     if (thisValue.Type == type)
     {
         return(thisValue);
     }
     if (thisValue.Type == EcmaValueType.Object)
     {
         if (thisValue.GetUnderlyingObjectInternal() is PrimitiveObject obj && obj.PrimitiveValue.Type == type)
         {
             return(obj.PrimitiveValue);
         }
     }
     throw new EcmaTypeErrorException(InternalString.Error.IncompatibleObject);
 }
示例#2
0
 private EcmaValue(EcmaValueType type, object value)
 {
     this.type  = type;
     this.value = value;
 }