Class: CastOff::Compiler::SimpleIR::Stack
- Inherits:
-
Object
- Object
- CastOff::Compiler::SimpleIR::Stack
show all
- Includes:
- Util
- Defined in:
- lib/cast_off/compile/ir/simple_ir.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Util
#bug, #dlog, #todo, #vlog
Constructor Details
#initialize(depth) ⇒ 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
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
|