v8javascript:C++;构造函数过滤代理? 看起来V8C++代码(Type)不把代理当作对象,而是返回默认目标。纯JavaScript(其他)中的相同场景与预期一样工作

v8javascript:C++;构造函数过滤代理? 看起来V8C++代码(Type)不把代理当作对象,而是返回默认目标。纯JavaScript(其他)中的相同场景与预期一样工作,javascript,node.js,constructor,ecmascript-6,v8,Javascript,Node.js,Constructor,Ecmascript 6,V8,用C实现的pass-thru函数++ static void tester(const FunctionCallbackInfo<Value>& info) { if (info.Length() > 0) { info.GetReturnValue().Set(info[0]); } } 输出: 10 10 x undefined 10 10 x x 我在这里。这看起来确实像一个bug。你能不能提交一个bug报告?请告诉我们你如何用

用C实现的pass-thru函数++

static void tester(const FunctionCallbackInfo<Value>& info) {
    if (info.Length() > 0) {
        info.GetReturnValue().Set(info[0]);
    }
}
输出:

10
10
x
undefined
10
10
x
x

我在这里。这看起来确实像一个bug。你能不能提交一个bug报告?

请告诉我们你如何用V8-编辑的样本注册C++函数,包括尚未安装的版本:
function other(x) {
    return x;
}

{
    let a = tester({x: 10});
    let b = new tester({x: 10});
    let c = tester(new Proxy({}, {get: function(target, name) { return name; }}));
    let d = new tester(new Proxy({}, {get: function(target, name) { return name; }}));

    print(a.x);
    print(b.x);
    print(c.x);
    print(d.x);
}

{
    let a = other({x: 10});
    let b = new other({x: 10});
    let c = other(new Proxy({}, {get: function(target, name) { return name; }}));
    let d = new other(new Proxy({}, {get: function(target, name) { return name; }}));

    print(a.x);
    print(b.x);
    print(c.x);
    print(d.x);
}
10
10
x
undefined
10
10
x
x