Skip to main content

gobject_ast/model/expression/
alloc_call.rs

1use serde::Serialize;
2
3use crate::model::{Expression, SourceLocation, TypeInfo};
4
5/// GLib allocation call: g_new(Type, n), g_renew(Type *, ptr, n), etc.
6/// These take a type as the first argument, not an expression.
7#[derive(Debug, Clone, Serialize)]
8pub struct AllocCallExpression {
9    /// The allocation function (g_new, g_new0, g_renew, g_slice_new, etc.)
10    pub function: Box<Expression>,
11
12    /// The type being allocated (parsed into TypeInfo)
13    pub allocated_type: TypeInfo,
14
15    /// The remaining arguments (e.g., count, existing pointer, etc.)
16    pub arguments: Vec<Box<Expression>>,
17
18    pub location: SourceLocation,
19}