Class: Gobstones::Lang::PuedeMover

Inherits:
OneArgExpression show all
Defined in:
lib/gobstones/lang/expressions/primitive_functions.rb

Instance Attribute Summary

Attributes inherited from OneArgExpression

#argument

Instance Method Summary collapse

Methods inherited from OneArgExpression

#equality_attributes, #initialize, #with_evaluated_argument_in

Methods inherited from Expression

#is_function_call?

Methods included from EqualityDefinition

#==, #equality_attributes

Constructor Details

This class inherits a constructor from Gobstones::Lang::OneArgExpression

Instance Method Details

#argument_typeObject



43
44
45
# File 'lib/gobstones/lang/expressions/primitive_functions.rb', line 43

def argument_type
  :Direction
end

#evaluate(context) ⇒ Object



33
34
35
36
37
# File 'lib/gobstones/lang/expressions/primitive_functions.rb', line 33

def evaluate(context)
  with_evaluated_argument_in(context) do |result|
    context.head.can_move?(result).to_gbs_bool
  end
end

#to_sObject



39
40
41
# File 'lib/gobstones/lang/expressions/primitive_functions.rb', line 39

def to_s
  'puedeMover() expression'
end

#type_checkObject



47
48
49
# File 'lib/gobstones/lang/expressions/primitive_functions.rb', line 47

def type_check
  TypeCheckResult.new(argument_type, argument.return_type)
end