UNPKG

1.17 kBTypeScriptView Raw
1import NameManager from "../NameManager";
2import TokenProcessor from "../TokenProcessor";
3import RootTransformer from "../transformers/RootTransformer";
4export interface ClassHeaderInfo {
5 isExpression: boolean;
6 className: string | null;
7 hasSuperclass: boolean;
8}
9export interface TokenRange {
10 start: number;
11 end: number;
12}
13export interface FieldInfo extends TokenRange {
14 equalsIndex: number;
15 initializerName: string;
16}
17/**
18 * Information about a class returned to inform the implementation of class fields and constructor
19 * initializers.
20 */
21export interface ClassInfo {
22 headerInfo: ClassHeaderInfo;
23 constructorInitializerStatements: Array<string>;
24 instanceInitializerNames: Array<string>;
25 staticInitializerNames: Array<string>;
26 constructorInsertPos: number | null;
27 fields: Array<FieldInfo>;
28 rangesToRemove: Array<TokenRange>;
29}
30/**
31 * Get information about the class fields for this class, given a token processor pointing to the
32 * open-brace at the start of the class.
33 */
34export default function getClassInfo(rootTransformer: RootTransformer, tokens: TokenProcessor, nameManager: NameManager): ClassInfo;