mxmlextrema_as3parser/tree/
type_expression.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use crate::ns::*;
use serde::{Serialize, Deserialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NullableTypeExpression {
    pub location: Location,
    pub base: Rc<Expression>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NonNullableTypeExpression {
    pub location: Location,
    pub base: Rc<Expression>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AnyTypeExpression {
    pub location: Location,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VoidTypeExpression {
    pub location: Location,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ArrayTypeExpression {
    pub location: Location,
    pub expression: Rc<Expression>,
}

/// A tuple type expression consisting of at least two elements.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TupleTypeExpression {
    pub location: Location,
    pub expressions: Vec<Rc<Expression>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FunctionTypeExpression {
    pub location: Location,
    pub parameters: Vec<Rc<FunctionTypeParameter>>,
    pub result_type: Option<Rc<Expression>>,
}

/// ```plain
/// function(T, T=, ...)
/// function(...[T])
/// ```
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FunctionTypeParameter {
    pub location: Location,
    pub kind: ParameterKind,
    /// Possibly `None` for the rest parameter.
    pub type_expression: Option<Rc<Expression>>,
}