mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
!10009 chmod number and string should be shared types
Merge pull request !10009 from zhangyouyou/master
This commit is contained in:
commit
0b0c1c33d7
@ -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());
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user