interface / enum type support in the sendable class
Background:
Expand the range of supported types for member variables in the sendable class, this pr will support the interface/enum type
Code scenario
import { Country } from './test.ts'
const enum City {
BeiJing = 'beijing',
ShangHai = 'shanghai',
};
interface Position {};
class Person {
name: string;
private age: number;
country: Country; // new support
city: City; // new support
pos: Position; // new support
mix: Country | City | Position; // new support
constructor() {
"use sendable";
}
}
Analysis:
Typescript has two types of annotations for interface / enum, both are ts type reference.
Fieldtype Mapping:
- interface: TS_TYPE_REF
- enum: NUMBER | STRING
- module type: GENERIC
Scheme design:
- ets-loader: Added support for interface / enum
- ets_frontend: identifies interface / enum and marks fieldtype, passing type information to the runtime via Literalbuffer
Issue: #I9CTN6:[ArkTS Linter] Implement new rules for Sendable API
TEST
Item | Result |
---|---|
262 | |
compiler | |
parser | |
tsc | |
hot && cold | |
base64 | |
type | |
bytecode | |
debugger |
verifier test:
./build.sh --product-name rk3568 --build-target arkcompiler/runtime_core:runtime_core_host_unittest
python3 /mnt/data/.../workspace/arkcompiler/runtime_core/verifier/tests/verify_sys_hap_abc.py --hap-dir /mnt/data/.../workspace/applications/standard/hap --verifier-dir /mnt/data/.../workspace/out/rk3568/clang_x64/arkcompiler/runtime_core/ark_verifier