GetPrimitiveValuePreES6() private method

Returns a primitive value that represents the current object, without using the @@toPrimitive symbol.
private GetPrimitiveValuePreES6 ( PrimitiveTypeHint typeHint ) : object
typeHint PrimitiveTypeHint Indicates the preferred type of the result.
return object
コード例 #1
0
ファイル: DateInstance.cs プロジェクト: paulbartrum/jurassic
 private static object ToPrimitive(ScriptEngine engine, ObjectInstance thisObj, string hint)
 {
     // This behaviour differs from the standard behaviour only in that the "default" hint
     // results in a conversion to a string, not a number.
     if (hint == "default" || hint == "string")
         return thisObj.GetPrimitiveValuePreES6(PrimitiveTypeHint.String);
     if (hint == "number")
         return thisObj.GetPrimitiveValuePreES6(PrimitiveTypeHint.Number);
     throw new JavaScriptException(engine, ErrorType.TypeError, "Invalid type hint.");
 }