mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
Fix regress test
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAJ0YZ?from=project-issue Signed-off-by: 刘智杰 <liuzhijie9@huawei.com> Change-Id: I6118689f0c766c5adfd855981adec895ad879292
This commit is contained in:
parent
a9ed70bed4
commit
a3e553891a
@ -345,9 +345,8 @@ JSTaggedValue BuiltinsFunction::FunctionPrototypeToString(EcmaRuntimeCallInfo *a
|
||||
if (thisValue->IsJSObject() && thisValue->IsCallable()) {
|
||||
JSHandle<Method> method;
|
||||
if (thisValue->IsBoundFunction()) {
|
||||
JSHandle<JSBoundFunction> func = JSHandle<JSBoundFunction>::Cast(thisValue);
|
||||
JSHandle<JSTaggedValue> methodHandle(thread, func->GetMethod());
|
||||
method = JSHandle<Method>::Cast(methodHandle);
|
||||
std::string str = "function () { [native code] }";
|
||||
return GetTaggedString(thread, str.c_str());
|
||||
} else {
|
||||
JSHandle<JSFunction> func = JSHandle<JSFunction>::Cast(thisValue);
|
||||
JSHandle<JSTaggedValue> methodHandle(thread, func->GetMethod());
|
||||
|
@ -315,8 +315,8 @@ JSTaggedValue JSFunction::LengthGetter(JSThread *thread, const JSHandle<JSObject
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
if (targetLength->IsNumber()) {
|
||||
lengthValue =
|
||||
std::max(0u, static_cast<uint32_t>(JSTaggedValue::ToNumber(thread, targetLength).GetNumber()) -
|
||||
argsLength);
|
||||
std::max(0.0, JSTaggedValue::ToNumber(thread, targetLength).GetNumber() -
|
||||
static_cast<double>(argsLength));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
}
|
||||
|
@ -484,6 +484,9 @@ void ObjectOperator::GlobalLookupProperty()
|
||||
void ObjectOperator::LookupProperty()
|
||||
{
|
||||
while (true) {
|
||||
if (holder_->IsJSProxy()) {
|
||||
return;
|
||||
}
|
||||
UpdateIsTSHClass();
|
||||
LookupPropertyInHolder();
|
||||
if (IsFound()) {
|
||||
@ -497,10 +500,6 @@ void ObjectOperator::LookupProperty()
|
||||
}
|
||||
|
||||
holder_.Update(proto);
|
||||
if (holder_->IsJSProxy()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SetIsOnPrototype(true);
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ group("ark_js_moduletest") {
|
||||
"rangeerror",
|
||||
"regexpcallthrow",
|
||||
"regexpflagd",
|
||||
"regressfunction",
|
||||
"regexpmaxindex",
|
||||
"regress",
|
||||
"regressmathmaxmin",
|
||||
|
@ -18,7 +18,7 @@
|
||||
37,1,2,3
|
||||
42
|
||||
42
|
||||
function bound Float32Array() { [native code] }
|
||||
function () { [native code] }
|
||||
1
|
||||
0,1,2,3,4,5,6,7,8,9,
|
||||
11
|
||||
|
18
test/moduletest/regressfunction/BUILD.gn
Executable file
18
test/moduletest/regressfunction/BUILD.gn
Executable file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_moduletest_action("regressfunction") {
|
||||
deps = []
|
||||
}
|
15
test/moduletest/regressfunction/expect_output.txt
Executable file
15
test/moduletest/regressfunction/expect_output.txt
Executable file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
0
|
||||
function () { [native code] }
|
21
test/moduletest/regressfunction/regressfunction.js
Executable file
21
test/moduletest/regressfunction/regressfunction.js
Executable file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function foo(x, y, z) {
|
||||
return [this, arguments.length, x];
|
||||
}
|
||||
|
||||
let f = foo.bind(foo, 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
print(f.length);
|
||||
print(f.toString());
|
@ -12,3 +12,4 @@
|
||||
# limitations under the License.
|
||||
|
||||
true
|
||||
proxied cause
|
||||
|
@ -30,3 +30,8 @@
|
||||
print(error instanceof TypeError);
|
||||
}
|
||||
})();
|
||||
|
||||
const options = { cause: 'a cause' };
|
||||
const proxy = new Proxy(options, { get: () => 'proxied cause'});
|
||||
const err = Error('message', proxy);
|
||||
print(err.cause);
|
||||
|
Loading…
Reference in New Issue
Block a user