Skip to main content

oak_csharp/ast/
mod.rs

1#![doc = include_str!("readme.md")]
2//! C# AST definitions
3
4use core::range::Range;
5#[cfg(feature = "serde")]
6use serde::{Deserialize, Serialize};
7
8/// Root node of the C# AST.
9#[derive(Debug, Clone, PartialEq)]
10#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
11pub struct CSharpRoot {
12    /// Items in the compilation unit.
13    pub items: Vec<Item>,
14}
15
16/// Top-level items in a C# program.
17#[derive(Debug, Clone, PartialEq)]
18#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
19pub enum Item {
20    /// Namespace declaration.
21    Namespace(NamespaceDeclaration),
22    /// Using directive.
23    Using(UsingDirective),
24    /// Class declaration.
25    Class(ClassDeclaration),
26    /// Interface declaration.
27    Interface(InterfaceDeclaration),
28    /// Struct declaration.
29    Struct(StructDeclaration),
30    /// Enum declaration.
31    Enum(EnumDeclaration),
32    /// Record declaration.
33    Record(RecordDeclaration),
34    /// Delegate declaration.
35    Delegate(DelegateDeclaration),
36}
37
38/// Namespace declaration.
39///
40/// Represents a `namespace` block in C#, which groups related classes and other types.
41/// Supports both block-scoped and file-scoped namespaces (C# 10+).
42#[derive(Debug, Clone, PartialEq)]
43#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
44pub struct NamespaceDeclaration {
45    /// The fully qualified name of the namespace (e.g., "System.Collections.Generic").
46    pub name: String,
47    /// Attributes applied to the namespace declaration.
48    pub attributes: Vec<Attribute>,
49    /// Types and nested namespaces defined within this namespace.
50    pub items: Vec<Item>,
51    /// Source location of the entire namespace declaration.
52    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
53    pub span: Range<usize>,
54}
55
56/// Using directive.
57///
58/// Represents a `using` statement used to import types from a namespace or to create aliases.
59/// Supports `using`, `using static`, and `global using`.
60#[derive(Debug, Clone, PartialEq)]
61#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
62pub struct UsingDirective {
63    /// The namespace or type path being imported.
64    pub path: String,
65    /// Indicates if this is a `using static` directive.
66    pub is_static: bool,
67    /// An optional alias for the namespace or type (e.g., `using Project = MyCompany.Project;`).
68    pub alias: Option<String>,
69    /// Indicates if this is a `global using` directive (C# 10+).
70    pub is_global: bool,
71    /// Source location of the using directive.
72    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
73    pub span: Range<usize>,
74}
75
76/// Class declaration.
77///
78/// Represents a `class` definition in C#. Classes are the primary reference types
79/// in C# and support inheritance, interfaces, and generics.
80#[derive(Debug, Clone, PartialEq)]
81#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
82pub struct ClassDeclaration {
83    /// The name of the class.
84    pub name: String,
85    /// Attributes applied to the class.
86    pub attributes: Vec<Attribute>,
87    /// Modifiers like `public`, `private`, `static`, `abstract`, `sealed`, `partial`.
88    pub modifiers: Vec<String>,
89    /// The base class and any implemented interfaces.
90    pub base_types: Vec<String>,
91    /// Generic type parameters (e.g., `T` in `List<T>`).
92    pub type_parameters: Vec<TypeParameter>,
93    /// Constraints on generic type parameters (e.g., `where T : class`).
94    pub constraints: Vec<TypeParameterConstraint>,
95    /// Members of the class, including fields, properties, methods, and nested types.
96    pub members: Vec<Member>,
97    /// Source location of the class declaration.
98    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
99    pub span: Range<usize>,
100}
101
102/// Struct declaration.
103///
104/// Represents a `struct` definition in C#. Structs are value types
105/// and are typically used for small, data-centric structures.
106#[derive(Debug, Clone, PartialEq)]
107#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
108pub struct StructDeclaration {
109    /// The name of the struct.
110    pub name: String,
111    /// Attributes applied to the struct.
112    pub attributes: Vec<Attribute>,
113    /// Modifiers like `public`, `private`, `readonly`, `ref`, `partial`.
114    pub modifiers: Vec<String>,
115    /// Members of the struct.
116    pub members: Vec<Member>,
117    /// Generic type parameters.
118    pub type_parameters: Vec<TypeParameter>,
119    /// Source location of the struct declaration.
120    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
121    pub span: Range<usize>,
122}
123
124/// Interface declaration.
125///
126/// Represents an `interface` definition in C#. Interfaces define a contract
127/// that classes or structs must implement.
128#[derive(Debug, Clone, PartialEq)]
129#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
130pub struct InterfaceDeclaration {
131    /// The name of the interface.
132    pub name: String,
133    /// Attributes applied to the interface.
134    pub attributes: Vec<Attribute>,
135    /// Modifiers like `public`, `internal`, `partial`.
136    pub modifiers: Vec<String>,
137    /// Members defined in the interface (methods, properties, etc.).
138    pub members: Vec<Member>,
139    /// Generic type parameters.
140    pub type_parameters: Vec<TypeParameter>,
141    /// Source location of the interface declaration.
142    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
143    pub span: Range<usize>,
144}
145
146/// Enum declaration.
147///
148/// Represents an `enum` definition in C#. Enums are value types that
149/// consist of a set of named constants.
150#[derive(Debug, Clone, PartialEq)]
151#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
152pub struct EnumDeclaration {
153    /// The name of the enum.
154    pub name: String,
155    /// Attributes applied to the enum.
156    pub attributes: Vec<Attribute>,
157    /// Modifiers like `public`, `internal`.
158    pub modifiers: Vec<String>,
159    /// The individual members (constants) of the enum.
160    pub members: Vec<EnumMember>,
161    /// Source location of the enum declaration.
162    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
163    pub span: Range<usize>,
164}
165
166/// Enum member.
167#[derive(Debug, Clone, PartialEq)]
168#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
169pub struct EnumMember {
170    /// Member name.
171    pub name: String,
172    /// Attributes.
173    pub attributes: Vec<Attribute>,
174    /// Member value.
175    pub value: Option<Expression>,
176}
177
178/// Record declaration.
179///
180/// Represents a `record` definition in C# (C# 9+). Records provide built-in
181/// functionality for encapsulating data and supporting value-based equality.
182#[derive(Debug, Clone, PartialEq)]
183#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
184pub struct RecordDeclaration {
185    /// The name of the record.
186    pub name: String,
187    /// Attributes applied to the record.
188    pub attributes: Vec<Attribute>,
189    /// Modifiers like `public`, `private`, `sealed`, `partial`.
190    pub modifiers: Vec<String>,
191    /// Members of the record.
192    pub members: Vec<Member>,
193    /// Generic type parameters.
194    pub type_parameters: Vec<TypeParameter>,
195    /// Source location of the record declaration.
196    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
197    pub span: Range<usize>,
198}
199
200/// Delegate declaration.
201///
202/// Represents a `delegate` definition in C#. Delegates are reference types
203/// that represent a method with a particular parameter list and return type.
204#[derive(Debug, Clone, PartialEq)]
205#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
206pub struct DelegateDeclaration {
207    /// The name of the delegate.
208    pub name: String,
209    /// Attributes applied to the delegate.
210    pub attributes: Vec<Attribute>,
211    /// Modifiers like `public`, `internal`.
212    pub modifiers: Vec<String>,
213    /// The return type of the method signature.
214    pub return_type: String,
215    /// Generic type parameters.
216    pub type_parameters: Vec<TypeParameter>,
217    /// The parameters of the delegate method signature.
218    pub parameters: Vec<Parameter>,
219    /// Source location of the delegate declaration.
220    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
221    pub span: Range<usize>,
222}
223
224/// Member declaration.
225///
226/// Represents various members that can be declared within a class, struct,
227/// or interface.
228#[derive(Debug, Clone, PartialEq)]
229#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
230pub enum Member {
231    /// Method declaration.
232    Method(MethodDeclaration),
233    /// Field declaration.
234    Field(FieldDeclaration),
235    /// Property declaration.
236    Property(PropertyDeclaration),
237    /// Indexer declaration.
238    Indexer(IndexerDeclaration),
239    /// Constructor declaration.
240    Constructor(MethodDeclaration),
241    /// Event declaration.
242    Event(EventDeclaration),
243}
244
245/// Method declaration.
246///
247/// Represents a method or constructor declaration, including its signature,
248/// modifiers, and optional body.
249#[derive(Debug, Clone, PartialEq)]
250#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
251pub struct MethodDeclaration {
252    /// Method name.
253    pub name: String,
254    /// Attributes.
255    pub attributes: Vec<Attribute>,
256    /// Modifiers.
257    pub modifiers: Vec<String>,
258    /// Return type.
259    pub return_type: String,
260    /// Type parameters.
261    pub type_parameters: Vec<TypeParameter>,
262    /// Parameters.
263    pub parameters: Vec<Parameter>,
264    /// Method body.
265    pub body: Option<Vec<Statement>>,
266    /// Whether it's an async method.
267    pub is_async: bool,
268    /// Source location.
269    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
270    pub span: Range<usize>,
271}
272
273/// Property declaration.
274///
275/// Represents a C# property with optional get and set accessors.
276#[derive(Debug, Clone, PartialEq)]
277#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
278pub struct PropertyDeclaration {
279    /// Property name.
280    pub name: String,
281    /// Attributes.
282    pub attributes: Vec<Attribute>,
283    /// Property type.
284    pub r#type: String,
285    /// Modifiers.
286    pub modifiers: Vec<String>,
287    /// Get accessor.
288    pub get_accessor: Option<Accessor>,
289    /// Set accessor.
290    pub set_accessor: Option<Accessor>,
291    /// Source location.
292    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
293    pub span: Range<usize>,
294}
295
296/// Accessor (get/set).
297///
298/// Represents a property or indexer accessor, which can contain a body
299/// of statements or be auto-implemented.
300#[derive(Debug, Clone, PartialEq)]
301#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
302pub struct Accessor {
303    /// Attributes.
304    pub attributes: Vec<Attribute>,
305    /// Accessor body.
306    pub body: Option<Vec<Statement>>,
307    /// Modifiers.
308    pub modifiers: Vec<String>,
309}
310
311/// Indexer declaration.
312///
313/// Represents a C# indexer (`this[...]`), which allows objects to be indexed
314/// like arrays.
315#[derive(Debug, Clone, PartialEq)]
316#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
317pub struct IndexerDeclaration {
318    /// Attributes.
319    pub attributes: Vec<Attribute>,
320    /// Indexer type.
321    pub r#type: String,
322    /// Parameters.
323    pub parameters: Vec<Parameter>,
324    /// Get accessor.
325    pub get_accessor: Option<Accessor>,
326    /// Set accessor.
327    pub set_accessor: Option<Accessor>,
328    /// Source location.
329    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
330    pub span: Range<usize>,
331}
332
333/// Event declaration.
334///
335/// Represents a C# `event` member, which provides a way for a class to notify
336/// other classes when something of interest occurs.
337#[derive(Debug, Clone, PartialEq)]
338#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
339pub struct EventDeclaration {
340    /// Event name.
341    pub name: String,
342    /// Attributes.
343    pub attributes: Vec<Attribute>,
344    /// Event type.
345    pub r#type: String,
346    /// Modifiers.
347    pub modifiers: Vec<String>,
348    /// Source location.
349    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
350    pub span: Range<usize>,
351}
352
353/// Parameter.
354///
355/// Represents a parameter in a method, constructor, or delegate signature.
356#[derive(Debug, Clone, PartialEq)]
357#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
358pub struct Parameter {
359    /// Attributes.
360    pub attributes: Vec<Attribute>,
361    /// Parameter name.
362    pub name: String,
363    /// Parameter type.
364    pub r#type: String,
365    /// Modifiers (ref, out, params).
366    pub modifiers: Vec<String>,
367    /// Default value.
368    pub default_value: Option<Expression>,
369}
370
371/// Field declaration.
372///
373/// Represents a field within a class or struct.
374#[derive(Debug, Clone, PartialEq)]
375#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
376pub struct FieldDeclaration {
377    /// Field name.
378    pub name: String,
379    /// Attributes.
380    pub attributes: Vec<Attribute>,
381    /// Field type.
382    pub r#type: String,
383    /// Modifiers.
384    pub modifiers: Vec<String>,
385    /// Initializer.
386    pub initializer: Option<Expression>,
387    /// Source location.
388    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
389    pub span: Range<usize>,
390}
391
392/// Attribute.
393///
394/// Represents a C# attribute applied to a program element (class, method, etc.).
395#[derive(Debug, Clone, PartialEq)]
396#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
397pub struct Attribute {
398    /// Attribute name.
399    pub name: String,
400    /// Argument list.
401    pub arguments: Vec<Expression>,
402    /// Source location.
403    #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
404    pub span: Range<usize>,
405}
406
407/// Type parameter.
408///
409/// Represents a generic type parameter (e.g., `T` in `List<T>`).
410#[derive(Debug, Clone, PartialEq)]
411#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
412pub struct TypeParameter {
413    /// Parameter name.
414    pub name: String,
415    /// Attributes.
416    pub attributes: Vec<Attribute>,
417    /// Variance (in, out).
418    pub variance: Option<String>,
419}
420
421/// Type parameter constraint.
422///
423/// Represents a constraint on a generic type parameter (e.g., `where T : class`).
424#[derive(Debug, Clone, PartialEq)]
425#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
426pub struct TypeParameterConstraint {
427    /// Type parameter name.
428    pub parameter_name: String,
429    /// Constraints.
430    pub constraints: Vec<String>,
431}
432
433/// Statement.
434///
435/// Represents various C# statements that can appear within a method body or block.
436#[derive(Debug, Clone, PartialEq)]
437#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
438pub enum Statement {
439    /// Expression statement.
440    Expression(Expression),
441    /// Return statement.
442    Return(Option<Expression>),
443    /// Block statement.
444    Block(Vec<Statement>),
445    /// If statement.
446    If {
447        /// The condition expression.
448        condition: Expression,
449        /// The then branch statement.
450        then_branch: Box<Statement>,
451        /// The optional else branch statement.
452        else_branch: Option<Box<Statement>>,
453    },
454    /// While loop.
455    While {
456        /// The condition expression.
457        condition: Expression,
458        /// The loop body.
459        body: Box<Statement>,
460    },
461    /// For loop.
462    For {
463        /// The initializer statement.
464        init: Option<Box<Statement>>,
465        /// The condition expression.
466        condition: Option<Expression>,
467        /// The update expression.
468        update: Option<Expression>,
469        /// The loop body.
470        body: Box<Statement>,
471    },
472    /// Foreach loop.
473    Foreach {
474        /// The item type name.
475        item_type: String,
476        /// The item variable name.
477        item_name: String,
478        /// The iterable expression.
479        iterable: Expression,
480        /// The loop body.
481        body: Box<Statement>,
482    },
483    /// Local variable declaration.
484    LocalVariable {
485        /// The variable type name.
486        r#type: String,
487        /// The variable name.
488        name: String,
489        /// The optional initializer expression.
490        initializer: Option<Expression>,
491    },
492    /// Break.
493    Break,
494    /// Continue.
495    Continue,
496}
497
498/// Expression.
499///
500/// Represents various C# expressions that can be evaluated to a value.
501#[derive(Debug, Clone, PartialEq)]
502#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
503pub enum Expression {
504    /// Literal.
505    Literal(Literal),
506    /// Identifier.
507    Identifier(String),
508    /// Method call.
509    MethodCall(MethodCall),
510    /// Member access.
511    MemberAccess(MemberAccess),
512    /// Element access.
513    ElementAccess(ElementAccess),
514    /// New expression.
515    New(NewExpression),
516    /// This expression.
517    This,
518    /// Base expression.
519    Base,
520    /// Binary expression.
521    Binary {
522        /// The left operand.
523        left: Box<Expression>,
524        /// The operator string.
525        op: String,
526        /// The right operand.
527        right: Box<Expression>,
528    },
529    /// Unary expression.
530    Unary {
531        /// The operator string.
532        op: String,
533        /// The operand expression.
534        expression: Box<Expression>,
535    },
536    /// Assignment expression.
537    Assignment {
538        /// The left-hand side expression.
539        left: Box<Expression>,
540        /// The operator string.
541        op: String,
542        /// The right-hand side expression.
543        right: Box<Expression>,
544    },
545    /// Await expression.
546    Await(Box<Expression>),
547    /// LINQ query expression.
548    Query(Box<QueryExpression>),
549}
550
551/// LINQ query expression.
552///
553/// Represents a LINQ query (e.g., `from x in items where x > 0 select x`).
554#[derive(Debug, Clone, PartialEq)]
555#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
556pub struct QueryExpression {
557    /// From clause.
558    pub from_clause: FromClause,
559    /// Query body.
560    pub body: QueryBody,
561}
562
563/// From clause.
564///
565/// Represents a `from` clause in a LINQ query.
566#[derive(Debug, Clone, PartialEq)]
567#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
568pub struct FromClause {
569    /// Identifier.
570    pub identifier: String,
571    /// Expression.
572    pub expression: Box<Expression>,
573}
574
575/// Query body.
576///
577/// Represents the body of a LINQ query, containing clauses and a select/group clause.
578#[derive(Debug, Clone, PartialEq)]
579#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
580pub struct QueryBody {
581    /// Query clauses.
582    pub clauses: Vec<QueryClause>,
583    /// Select or group clause.
584    pub select_or_group: SelectOrGroupClause,
585    /// Continuation (into).
586    pub continuation: Option<String>,
587}
588
589/// Query clause.
590///
591/// Represents a clause within a LINQ query body.
592#[derive(Debug, Clone, PartialEq)]
593#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
594pub enum QueryClause {
595    /// From clause.
596    From(FromClause),
597    /// Let clause.
598    Let(LetClause),
599    /// Where clause.
600    Where(Expression),
601    /// Join clause.
602    Join(JoinClause),
603    /// OrderBy clause.
604    OrderBy(Vec<Ordering>),
605}
606
607/// Query clause extension.
608#[derive(Debug, Clone, PartialEq)]
609#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
610pub enum QueryClauseExt {
611    /// GroupBy clause.
612    GroupBy(Expression),
613}
614
615/// Let clause.
616///
617/// Represents a `let` clause in a LINQ query, used to store sub-expression results.
618#[derive(Debug, Clone, PartialEq)]
619#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
620pub struct LetClause {
621    /// Identifier.
622    pub identifier: String,
623    /// Expression.
624    pub expression: Expression,
625}
626
627/// Join clause.
628///
629/// Represents a `join` clause in a LINQ query.
630#[derive(Debug, Clone, PartialEq)]
631#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
632pub struct JoinClause {
633    /// Identifier.
634    pub identifier: String,
635    /// In expression.
636    pub in_expression: Expression,
637    /// On expression.
638    pub on_expression: Expression,
639    /// Equals expression.
640    pub equals_expression: Expression,
641    /// Into identifier.
642    pub into_identifier: Option<String>,
643}
644
645/// Ordering.
646///
647/// Represents an `orderby` criterion in a LINQ query.
648#[derive(Debug, Clone, PartialEq)]
649#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
650pub struct Ordering {
651    /// Expression.
652    pub expression: Expression,
653    /// Whether it's ascending.
654    pub ascending: bool,
655}
656
657/// Select or group clause.
658///
659/// Represents the final `select` or `group` clause of a LINQ query.
660#[derive(Debug, Clone, PartialEq)]
661#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
662pub enum SelectOrGroupClause {
663    /// Select clause.
664    Select(Expression),
665    /// Group clause.
666    Group {
667        /// Expression.
668        expression: Expression,
669        /// By expression.
670        by_expression: Expression,
671    },
672}
673
674/// New expression.
675///
676/// Represents an object creation expression (e.g., `new MyClass(args)`).
677#[derive(Debug, Clone, PartialEq)]
678#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
679pub struct NewExpression {
680    /// Type name.
681    pub r#type: String,
682    /// Argument list.
683    pub arguments: Vec<Expression>,
684}
685
686/// Literal.
687///
688/// Represents a constant value of a primitive type.
689#[derive(Debug, Clone, PartialEq)]
690#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
691pub enum Literal {
692    /// Integer.
693    Integer(i64),
694    /// String.
695    String(String),
696    /// Boolean.
697    Boolean(bool),
698    /// Null.
699    Null,
700}
701
702/// Member access.
703///
704/// Represents accessing a member of an object (e.g., `obj.Member`).
705#[derive(Debug, Clone, PartialEq)]
706#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
707pub struct MemberAccess {
708    /// Target expression.
709    pub target: Box<Expression>,
710    /// Member name.
711    pub name: String,
712}
713
714/// Method call.
715///
716/// Represents a method invocation (e.g., `target.Method(args)` or `Method(args)`).
717#[derive(Debug, Clone, PartialEq)]
718#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
719pub struct MethodCall {
720    /// Target expression.
721    pub target: Option<Box<Expression>>,
722    /// Method name.
723    pub name: String,
724    /// Argument list.
725    pub arguments: Vec<Expression>,
726}
727
728/// Element access (indexer).
729///
730/// Represents an element access via indexers (e.g., `array[index]`).
731#[derive(Debug, Clone, PartialEq)]
732#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
733pub struct ElementAccess {
734    /// Target expression.
735    pub target: Box<Expression>,
736    /// Argument list.
737    pub arguments: Vec<Expression>,
738}