!10009 chmod number and string should be shared types

Merge pull request !10009 from zhangyouyou/master
This commit is contained in:
openharmony_ci 2024-10-30 18:36:14 +00:00 committed by Gitee
commit 0b0c1c33d7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 18 additions and 9 deletions

View File

@ -1358,8 +1358,8 @@ JSTaggedValue SourceTextModule::FindByExport(const JSTaggedValue &exportEntriesT
void SourceTextModule::StoreModuleValue(JSThread *thread, int32_t index, const JSHandle<JSTaggedValue> &value)
{
JSHandle<SourceTextModule> module(thread, this);
if (UNLIKELY(IsSharedModule(module)) && !value->IsJSShared()) {
CString msg = "Export non-shared object form shared-module, module name is :" +
if (UNLIKELY(IsSharedModule(module)) && !value->IsSharedType()) {
CString msg = "Export non-shared object from shared-module, module name is :" +
module->GetEcmaModuleRecordNameString();
THROW_ERROR(thread, ErrorType::SYNTAX_ERROR, msg.c_str());
}
@ -1388,8 +1388,8 @@ void SourceTextModule::StoreModuleValue(JSThread *thread, const JSHandle<JSTagge
const JSHandle<JSTaggedValue> &value)
{
JSHandle<SourceTextModule> module(thread, this);
if (UNLIKELY(IsSharedModule(module)) && !value->IsJSShared()) {
CString msg = "Export non-shared object form shared-module, module name is :" +
if (UNLIKELY(IsSharedModule(module)) && !value->IsSharedType()) {
CString msg = "Export non-shared object from shared-module, module name is :" +
module->GetEcmaModuleRecordNameString();
THROW_ERROR(thread, ErrorType::SYNTAX_ERROR, msg.c_str());
}

View File

@ -12,4 +12,6 @@
# limitations under the License.
A
SyntaxError: Export non-shared object form shared-module, module name is :func
100
false
SyntaxError: Export non-shared object from shared-module, module name is :func

View File

@ -23,7 +23,7 @@
// @ts-nocheck
declare function print(str: any): string;
import {foo} from "./string"
import {strA, strB, numberC, booleanD,foo} from "./string"
"use shared"
export class A {
@ -33,11 +33,13 @@ export class A {
}
}
new A()
new A();
print(numberC);
print(booleanD);
import('./func').then(ns => {
print(ns.h);
}).then().catch((err) => {
print(err);
}
)
)

View File

@ -22,6 +22,11 @@
// @ts-nocheck
declare function print(str: any): string;
"use shared"
export var strA : string = "(This is strA!)";
export var strB : string = "(This is strB!)";
export var numberC : number = 100;
export var booleanD : bool = false;
export function foo() {
'use sendable'
print("foo");