Closed omochi closed 5 months ago
The current JSObject.construct(from:) failed with JSValues where its case is function, symbol, or bigInt.
JSObject.construct(from:)
JSValue
For example, JSFunction.construct succeeds with case function and JSObject.construct doesn't, but it should succeed because JSFunction is a JSObject.
JSFunction.construct
case function
JSObject.construct
JSFunction
JSObject
symbol and bigint are primitive values in JavaScript side, and because of:
Symbol("s") instanceof Object // false
It's unclear if JSObject.construct(symbol) should succeed or nor, but I think it should because JSSymbol is a JSObject.
JSObject.construct(symbol)
JSSymbol
Note for function case:
function
(() => {}) instanceof Object // true
従来の実装では、JSValue の case が function, symbol, bigInt であるような JSValue を、 JSObject.construct(from:) に渡した場合にデコードに失敗していました。
例えば JSFunction.construct に case function を渡す場合は成功しますが、 値がfunction であるとわからない状況においても、 JSFunction is JSObject である以上、 JSObject としてのデコードが成功する必要があります。
symbol と bigInt については JavaScript側においてはプリミティブであり、
なので、 JSObject としてデコードできるのが正しいのかよくわからないですが、 少なくとも JSSymbol is JSObject となっている以上は、 そうなるべきだと思います。
ちなみに function については
です。
The current
JSObject.construct(from:)
failed withJSValue
s where its case is function, symbol, or bigInt.For example,
JSFunction.construct
succeeds withcase function
andJSObject.construct
doesn't, but it should succeed becauseJSFunction
is aJSObject
.symbol and bigint are primitive values in JavaScript side, and because of:
It's unclear if
JSObject.construct(symbol)
should succeed or nor, but I think it should becauseJSSymbol
is aJSObject
.Note for
function
case:従来の実装では、
JSValue
の case が function, symbol, bigInt であるような JSValue を、JSObject.construct(from:)
に渡した場合にデコードに失敗していました。例えば
JSFunction.construct
に case function を渡す場合は成功しますが、 値がfunction であるとわからない状況においても、JSFunction
isJSObject
である以上、JSObject
としてのデコードが成功する必要があります。symbol と bigInt については JavaScript側においてはプリミティブであり、
なので、
JSObject
としてデコードできるのが正しいのかよくわからないですが、 少なくともJSSymbol
isJSObject
となっている以上は、 そうなるべきだと思います。ちなみに function については
です。