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
use crate::ir::*;

crate::ir! {
pub struct IrTypeDartOpaque;
}

impl IrTypeTrait for IrTypeDartOpaque {
    fn visit_children_types<F: FnMut(&IrType) -> bool>(&self, _f: &mut F, _ir_file: &IrFile) {
        // do nothing.
    }

    fn safe_ident(&self) -> String {
        "DartOpaque".to_owned()
    }

    fn dart_api_type(&self) -> String {
        "Object".to_owned()
    }

    fn dart_wire_type(&self, target: crate::target::Target) -> String {
        if target.is_wasm() {
            "Object"
        } else {
            "wire_DartOpaque"
        }
        .to_owned()
    }

    fn rust_api_type(&self) -> String {
        "DartOpaque".to_owned()
    }

    fn rust_wire_type(&self, target: crate::target::Target) -> String {
        if target.is_wasm() {
            "JsValue"
        } else {
            "wire_DartOpaque"
        }
        .to_owned()
    }
}