Class: SyntaxTree::YARV::PutNil

Inherits:
Instruction show all
Defined in:
lib/syntax_tree/yarv/instructions.rb

Overview

### Summary

‘putnil` pushes a global nil object onto the stack.

### Usage

~~~ruby nil ~~~

Instance Method Summary collapse

Methods inherited from Instruction

#branch_targets, #falls_through?, #leaves?, #length, #pops

Instance Method Details

#==(other) ⇒ Object



4597
4598
4599
# File 'lib/syntax_tree/yarv/instructions.rb', line 4597

def ==(other)
  other.is_a?(PutNil)
end

#call(vm) ⇒ Object



4609
4610
4611
# File 'lib/syntax_tree/yarv/instructions.rb', line 4609

def call(vm)
  canonical.call(vm)
end

#canonicalObject



4605
4606
4607
# File 'lib/syntax_tree/yarv/instructions.rb', line 4605

def canonical
  PutObject.new(nil)
end

#deconstruct_keys(_keys) ⇒ Object



4593
4594
4595
# File 'lib/syntax_tree/yarv/instructions.rb', line 4593

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



4585
4586
4587
# File 'lib/syntax_tree/yarv/instructions.rb', line 4585

def disasm(fmt)
  fmt.instruction("putnil")
end

#pushesObject



4601
4602
4603
# File 'lib/syntax_tree/yarv/instructions.rb', line 4601

def pushes
  1
end

#side_effects?Boolean

Returns:

  • (Boolean)


4613
4614
4615
# File 'lib/syntax_tree/yarv/instructions.rb', line 4613

def side_effects?
  false
end

#to_a(_iseq) ⇒ Object



4589
4590
4591
# File 'lib/syntax_tree/yarv/instructions.rb', line 4589

def to_a(_iseq)
  [:putnil]
end