Class: Nydp::Cond_LEX_LIT_LIT

Inherits:
CondBase show all
Defined in:
lib/nydp/cond.rb

Overview

def self.build cond, when_false

  case sig(when_false)
  when "LIT"
    OR_LEX_LIT.new(cond, nil, when_false)
  when "LEX"
    OR_LEX_LEX.new(cond, nil, when_false)
  else
    OR_LEX.new(cond, nil, when_false)
  end
end

end

Instance Method Summary collapse

Methods inherited from CondBase

#initialize, #inspect, #lexical_reach, #to_s

Methods included from Helper

#cons, #list, #literal?, #pair?, #sig, #sym, #sym?

Methods included from Converter

#n2r, #r2n

Constructor Details

This class inherits a constructor from Nydp::CondBase

Instance Method Details

#execute(vm) ⇒ Object

(def no (arg) (cond arg nil t))



169
170
171
172
# File 'lib/nydp/cond.rb', line 169

def execute vm
  falsity = Nydp::NIL.is?(@condition.value vm.current_context)
  vm.push_arg(falsity ? @when_false : @when_true)
end