some class field tests
This commit is contained in:
parent
dc58dbe2fe
commit
b76c140d32
@ -12,10 +12,8 @@ module Soml
|
|||||||
#puts "Define field #{name} on class #{for_class.name}"
|
#puts "Define field #{name} on class #{for_class.name}"
|
||||||
index = for_class.object_layout.add_instance_variable( name ) #TODO need typing
|
index = for_class.object_layout.add_instance_variable( name ) #TODO need typing
|
||||||
|
|
||||||
if value
|
# not sure how to run class code yet. later
|
||||||
value = process( value )
|
raise "value #{value}" if value
|
||||||
raise "value #{value}" #tbc
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil # statements don't reurn values, only expressions
|
return nil # statements don't reurn values, only expressions
|
||||||
end
|
end
|
||||||
|
@ -20,5 +20,31 @@ HERE
|
|||||||
@expect = [Label, SaveReturn,LoadConstant,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
@expect = [Label, SaveReturn,LoadConstant,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_class_field_value
|
||||||
|
@string_input = <<HERE
|
||||||
|
class Object
|
||||||
|
field int boo = 1
|
||||||
|
int main()
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
HERE
|
||||||
|
@expect = [Label, SaveReturn,LoadConstant,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||||
|
assert_raises{check}
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_class_field
|
||||||
|
@string_input = <<HERE
|
||||||
|
class Object
|
||||||
|
field int boo
|
||||||
|
int main()
|
||||||
|
return self.boo
|
||||||
|
end
|
||||||
|
end
|
||||||
|
HERE
|
||||||
|
@expect = [Label, SaveReturn,GetSlot,GetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||||
|
check
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user