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



4544
4545
4546
# File 'lib/syntax_tree/yarv/instructions.rb', line 4544

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

#call(vm) ⇒ Object



4556
4557
4558
# File 'lib/syntax_tree/yarv/instructions.rb', line 4556

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

#canonicalObject



4552
4553
4554
# File 'lib/syntax_tree/yarv/instructions.rb', line 4552

def canonical
  PutObject.new(nil)
end

#deconstruct_keys(_keys) ⇒ Object



4540
4541
4542
# File 'lib/syntax_tree/yarv/instructions.rb', line 4540

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



4532
4533
4534
# File 'lib/syntax_tree/yarv/instructions.rb', line 4532

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

#pushesObject



4548
4549
4550
# File 'lib/syntax_tree/yarv/instructions.rb', line 4548

def pushes
  1
end

#side_effects?Boolean

Returns:

  • (Boolean)


4560
4561
4562
# File 'lib/syntax_tree/yarv/instructions.rb', line 4560

def side_effects?
  false
end

#to_a(_iseq) ⇒ Object



4536
4537
4538
# File 'lib/syntax_tree/yarv/instructions.rb', line 4536

def to_a(_iseq)
  [:putnil]
end