mxmlextrema_as3parser/tree/
import_directive.rs1use crate::ns::*;
2use serde::{Serialize, Deserialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct ImportDirective {
6 pub location: Location,
7 pub alias: Option<(String, Location)>,
8 pub package_name: Vec<(String, Location)>,
9 pub import_specifier: ImportSpecifier,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub enum ImportSpecifier {
14 Wildcard(Location),
15 Recursive(Location),
16 Identifier((String, Location)),
17}
18
19impl ImportSpecifier {
20 pub fn location(&self) -> Location {
21 match self {
22 Self::Wildcard(l) |
23 Self::Recursive(l) => l.clone(),
24 Self::Identifier((_, l)) => l.clone(),
25 }
26 }
27}