Ver código fonte

nilable class contents

master
Ludovic 'Archivist' Lagouardette 5 anos atrás
pai
commit
e9e428f9e1
3 arquivos alterados com 20 adições e 9 exclusões
  1. +16
    -4
      src/andrew.cr
  2. +3
    -1
      src/views/class.ecr
  3. +1
    -4
      tests/record.yml

+ 16
- 4
src/andrew.cr Ver arquivo

@ -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 Ver arquivo

@ -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 Ver arquivo

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

Carregando…
Cancelar
Salvar