===========
enum struct
===========

enum struct MyStruct
{
    int a;
    float b;
    char c;
    bool d;
    char e[64];
    Action action;
}

---

(source_file
  (enum_struct
    name: (identifier)
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
    )
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
    )
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
    )
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
    )
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
      (fixed_dimension
        (int_literal)
      )
    )
    (enum_struct_field
      type: (type
        (identifier)
      )
      name: (identifier)
    )
  )
)


====================
enum struct - method
====================

enum struct Rectangle
{
    int width;
    int height;

    int Area() {
        return this.width * this.height;
    }

    int[] Area() {
        return this.width * this.height;
    }
}

---

(source_file
  (enum_struct
    name: (identifier)
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
    )
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
    )
    (enum_struct_method
      returnType: (type
        (builtin_type)
      )
      name: (identifier)
      parameters: (parameter_declarations)
      body: (block
        (return_statement
          expression: (binary_expression
            left: (field_access
              target: (this)
              field: (identifier)
            )
            right: (field_access
              target: (this)
              field: (identifier)
            )
          )
        )
      )
    )
    (enum_struct_method
      returnType: (type
        (builtin_type)
      )
      returnType: (dimension)
      name: (identifier)
      parameters: (parameter_declarations)
      body: (block
        (return_statement
          expression: (binary_expression
            left: (field_access
              target: (this)
              field: (identifier)
            )
            right: (field_access
              target: (this)
              field: (identifier)
            )
          )
        )
      )
    )
  )
)


====================================
enum struct - method with parameters
====================================

enum struct Rectangle
{
    int width;
    int height;

    bool CoversArea(const Rectangle r) {
        return r.width <= this.width && r.height <= this.height;
    }
}

---

(source_file
  (enum_struct
    name: (identifier)
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
    )
    (enum_struct_field
      type: (type
        (builtin_type)
      )
      name: (identifier)
    )
    (enum_struct_method
      returnType: (type
        (builtin_type)
      )
      name: (identifier)
      parameters: (parameter_declarations
        (parameter_declaration
          storage_class: (variable_storage_class)
          type: (type
            (identifier)
          )
          name: (identifier)
        )
      )
      body: (block
        (return_statement
          expression: (binary_expression
            left: (binary_expression
              left: (field_access
                target: (identifier)
                field: (identifier)
              )
              right: (field_access
                target: (this)
                field: (identifier)
              )
            )
            right: (binary_expression
              left: (field_access
                target: (identifier)
                field: (identifier)
              )
              right: (field_access
                target: (this)
                field: (identifier)
              )
            )
          )
        )
      )
    )
  )
)
