Class: CastOff::Compiler::SimpleIR::Stack
- Inherits:
-
Object
- Object
- CastOff::Compiler::SimpleIR::Stack
- Includes:
- Util
- Defined in:
- lib/cast_off/compile/ir/simple_ir.rb
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
Instance Method Summary collapse
-
#initialize(depth) ⇒ Stack
constructor
A new instance of Stack.
- #pop ⇒ Object
- #push ⇒ Object
Methods included from Util
Constructor Details
#initialize(depth) ⇒ Stack
Returns a new instance of Stack.
15 16 17 |
# File 'lib/cast_off/compile/ir/simple_ir.rb', line 15 def initialize(depth) @depth = depth end |
Instance Attribute Details
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
13 14 15 |
# File 'lib/cast_off/compile/ir/simple_ir.rb', line 13 def depth @depth end |
Instance Method Details
#pop ⇒ Object
19 20 21 22 23 |
# File 'lib/cast_off/compile/ir/simple_ir.rb', line 19 def pop() @depth -= 1 bug() if @depth < 0 @depth end |
#push ⇒ Object
25 26 27 28 29 |
# File 'lib/cast_off/compile/ir/simple_ir.rb', line 25 def push() ret = @depth @depth += 1 ret end |