oak_typescript/ast/
class_node.rs1use crate::ast::{Decorator, Expression, FunctionParam, Statement, TypeAnnotation, TypeParameter};
2use core::range::Range;
3#[cfg(feature = "serde")]
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone)]
7#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
8pub enum Visibility {
9 Public,
10 Private,
11 Protected,
12}
13
14#[derive(Debug, Clone)]
15#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
16pub enum ClassMember {
17 Property {
18 decorators: Vec<Decorator>,
19 name: String,
20 ty: Option<TypeAnnotation>,
21 initializer: Option<Expression>,
22 visibility: Option<Visibility>,
23 is_static: bool,
24 is_readonly: bool,
25 is_abstract: bool,
26 is_optional: bool,
27 #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
28 span: Range<usize>,
29 },
30 Method {
31 decorators: Vec<Decorator>,
32 name: String,
33 type_params: Vec<TypeParameter>,
34 params: Vec<FunctionParam>,
35 return_type: Option<TypeAnnotation>,
36 body: Vec<Statement>,
37 visibility: Option<Visibility>,
38 is_static: bool,
39 is_abstract: bool,
40 is_getter: bool,
41 is_setter: bool,
42 is_optional: bool,
43 #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
44 span: Range<usize>,
45 },
46}