Class: Chelsy::Type::Pointer

Inherits:
Derived show all
Defined in:
lib/chelsy/ast.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#fragments, #post_fragments

Instance Method Summary collapse

Methods inherited from Base

#const?, #volatile?

Constructor Details

#initialize(pointee, restrict: false, **rest) ⇒ Pointer

Returns a new instance of Pointer.



377
378
379
380
381
382
# File 'lib/chelsy/ast.rb', line 377

def initialize(pointee, restrict: false, **rest)
  @pointee = Syntax::Type.ensure(pointee)
  @restrict = !!restrict

  super(**rest)
end

Instance Attribute Details

#pointeeObject (readonly)

Returns the value of attribute pointee.



375
376
377
# File 'lib/chelsy/ast.rb', line 375

def pointee
  @pointee
end

Instance Method Details

#qualified?Boolean

Returns:

  • (Boolean)


386
387
388
# File 'lib/chelsy/ast.rb', line 386

def qualified?
  @restrict || super
end

#restrict?Boolean

Returns:

  • (Boolean)


384
# File 'lib/chelsy/ast.rb', line 384

def restrict?; @restrict end

#termination_typeObject



390
391
392
393
394
395
396
# File 'lib/chelsy/ast.rb', line 390

def termination_type
  pointee = self.pointee
  while pointee.is_a?(Type::Pointer)
    pointee = pointee.pointee
  end
  pointee
end