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



4498
4499
4500
# File 'lib/syntax_tree/yarv/instructions.rb', line 4498

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

#call(vm) ⇒ Object



4510
4511
4512
# File 'lib/syntax_tree/yarv/instructions.rb', line 4510

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

#canonicalObject



4506
4507
4508
# File 'lib/syntax_tree/yarv/instructions.rb', line 4506

def canonical
  PutObject.new(nil)
end

#deconstruct_keys(_keys) ⇒ Object



4494
4495
4496
# File 'lib/syntax_tree/yarv/instructions.rb', line 4494

def deconstruct_keys(_keys)
  {}
end

#disasm(fmt) ⇒ Object



4486
4487
4488
# File 'lib/syntax_tree/yarv/instructions.rb', line 4486

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

#pushesObject



4502
4503
4504
# File 'lib/syntax_tree/yarv/instructions.rb', line 4502

def pushes
  1
end

#side_effects?Boolean

Returns:

  • (Boolean)


4514
4515
4516
# File 'lib/syntax_tree/yarv/instructions.rb', line 4514

def side_effects?
  false
end

#to_a(_iseq) ⇒ Object



4490
4491
4492
# File 'lib/syntax_tree/yarv/instructions.rb', line 4490

def to_a(_iseq)
  [:putnil]
end