stmt_vec

Macro stmt_vec 

Source
macro_rules! stmt_vec {
    ($stmts:expr) => { ... };
}
Expand description

Wraps a Vec<Stmt> in a StmtVec for use with ts_quote!.

This macro is a convenience wrapper around creating a StmtVec directly. Use it when you need to pass multiple statements to a quote macro that expects a statement vector.

§Examples

use macroforge_ts_syn::stmt_vec;
use swc_core::ecma::ast::Stmt;

fn generate_method_body() -> Vec<Stmt> {
    // ... generate statements
    vec![]
}

let body = stmt_vec!(generate_method_body());