idlize

Форк
0
/
PeerClass.ts 
58 строк · 2.0 Кб
1
/*
2
 * Copyright (c) 2024 Huawei Device Co., Ltd.
3
 * Licensed under the Apache License, Version 2.0 (the "License");
4
 * you may not use this file except in compliance with the License.
5
 * You may obtain a copy of the License at
6
 *
7
 * http://www.apache.org/licenses/LICENSE-2.0
8
 *
9
 * Unless required by applicable law or agreed to in writing, software
10
 * distributed under the License is distributed on an "AS IS" BASIS,
11
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 * See the License for the specific language governing permissions and
13
 * limitations under the License.
14
 */
15

16
import { PeerFile } from "./PeerFile"
17
import { PeerMethod } from "./PeerMethod"
18
import { DeclarationTable } from "./DeclarationTable"
19

20
export interface PeerClassBase {
21
    setGenerationContext(context: string| undefined): void
22
    generatedName(isCallSignature: boolean): string
23

24
    // TBD: update
25
    getComponentName(): string
26
}
27

28
export class PeerClass implements PeerClassBase {
29
    constructor(
30
        public readonly file: PeerFile,
31
        public readonly componentName: string,
32
        public readonly originalFilename: string,
33
        public readonly declarationTable: DeclarationTable
34
    ) { }
35

36
    setGenerationContext(context: string| undefined): void {
37
        this.declarationTable.setCurrentContext(context)
38
    }
39

40
    generatedName(isCallSignature: boolean): string{
41
        return isCallSignature ? this.originalInterfaceName! : this.originalClassName!
42
    }
43

44
    getComponentName(): string {
45
        return this.componentName
46
    }
47

48
    methods: PeerMethod[] = []
49

50
    originalClassName: string | undefined = undefined
51
    originalInterfaceName: string | undefined = undefined
52
    originalParentName: string | undefined = undefined
53
    originalParentFilename: string | undefined = undefined
54
    parentComponentName: string | undefined = undefined
55
    attributesFields: string[] = []
56
    attributesTypes: {typeName: string, content: string}[] = []
57
    hasGenericType: boolean = false
58
}

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.