Sha256: baf1af7dd4d1e5b87ca166133b48e44ca20d6658d09c904548a5ed0b29a4b7e7

Contents?: true

Size: 409 Bytes

Versions: 3

Compression:

Stored size: 409 Bytes

Contents

module Xdrgen::AST
  class FixedSize < Treetop::Runtime::SyntaxNode
    def size
      size_t.text_value
    end

    def resolved_size
      return size unless named?

      resolved = root.find_definition(size)

      if resolved.blank?
        raise "Could not resolve constant: #{size}"
      end

      resolved.value
    end

    def named?
      size_t.is_a?(Xdrgen::AST::Identifier)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xdrgen-0.1.1 lib/xdrgen/ast/fixed_size.rb
xdrgen-0.1.0 lib/xdrgen/ast/fixed_size.rb
xdrgen-0.0.1 lib/xdrgen/ast/fixed_size.rb