Bladeren bron

nilable class contents

master
Ludovic 'Archivist' Lagouardette 5 jaren geleden
bovenliggende
commit
e9e428f9e1
3 gewijzigde bestanden met toevoegingen van 20 en 9 verwijderingen
  1. +16
    -4
      src/andrew.cr
  2. +3
    -1
      src/views/class.ecr
  3. +1
    -4
      tests/record.yml

+ 16
- 4
src/andrew.cr Bestand weergeven

@ -25,10 +25,22 @@ end
class ClassGenerator
YAML.mapping(
name: String,
bitfields: Array(BitfieldGenerator),
attributes: Array(AttributeGenerator),
repeats: Array(RepeatGenerator),
attributeafters: Array(AttributeAfterGenerator)
bitfields: {
type: Array(BitfieldGenerator),
nilable: true
},
attributes: {
type: Array(AttributeGenerator),
nilable: true
},
repeats: {
type: Array(RepeatGenerator),
nilable: true
},
attributeafters: {
type: Array(AttributeAfterGenerator),
nilable: true
}
)
def initialize(@name : String)

+ 3
- 1
src/views/class.ecr Bestand weergeven

@ -1,9 +1,11 @@
class <%= @name %> {
virtual <%= @name %>() = 0;
<%- @attributes.each do |attr| -%>
<% if !(@attributes.nil?) %>
<%- @attributes.not_nil!.each do |attr| -%>
<%= attr.to_s %>
<%- end -%>
<% end %>
};

+ 1
- 4
tests/record.yml Bestand weergeven

@ -45,7 +45,4 @@ classes:
name: flags
out_type: bitops::regulated<uint32_t>
start: 40
class_name: record
bitfields: []
repeats: []
attributeafters: []
class_name: record

Laden…
Annuleren
Opslaan