Class: CShadow::ShortAttribute
- Inherits:
-
IntAttribute
- Object
- Attribute
- CNativeAttribute
- IntAttribute
- CShadow::ShortAttribute
- Defined in:
- lib/cgen/attribute.rb
Overview
Does not check for overflow.
Instance Attribute Summary
Attributes inherited from CNativeAttribute
Attributes inherited from Attribute
#cdecl, #check, #cvar, #dump, #free, #init, #load, #mark, #owner_class, #persists, #reader, #var, #writer
Instance Method Summary collapse
-
#initialize(*args) ⇒ ShortAttribute
constructor
A new instance of ShortAttribute.
Methods inherited from CNativeAttribute
Methods inherited from Attribute
Constructor Details
#initialize(*args) ⇒ ShortAttribute
Returns a new instance of ShortAttribute.
325 326 327 328 329 330 331 |
# File 'lib/cgen/attribute.rb', line 325 def initialize(*args) super @reader = "result = INT2NUM(shadow->#{@cvar})" @writer = "shadow->#{@cvar} = NUM2INT(arg)" # type check and conversion @dump = "rb_ary_push(result, INT2NUM(shadow->#{@cvar}))" @load = "tmp = rb_ary_shift(from_array); shadow->#{@cvar} = NUM2INT(tmp)" end |