private GetPrimitiveValuePreES6 ( PrimitiveTypeHint typeHint ) : object | ||
typeHint | PrimitiveTypeHint | Indicates the preferred type of the result. |
return | object |
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."); }