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:

  1. ets-loader: Added support for interface / enum
  2. 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
输入图片说明