fix boot to include blocks correctly
This commit is contained in:
parent
4839e0d245
commit
e1d5592c55
@ -133,15 +133,15 @@ module Parfait
|
|||||||
# and all instance variable names. Really have to find a better way
|
# and all instance variable names. Really have to find a better way
|
||||||
def self.type_names
|
def self.type_names
|
||||||
{BinaryCode: {next: :BinaryCode} ,
|
{BinaryCode: {next: :BinaryCode} ,
|
||||||
Block: {binary: :BinaryCode, next: :CallableMethod,
|
Block: {binary: :BinaryCode, next: :Block,
|
||||||
arguments_type: :Type , self_type: :Type, frame_type: :Type } ,
|
arguments_type: :Type , self_type: :Type, frame_type: :Type } ,
|
||||||
|
|
||||||
CacheEntry: {cached_type: :Type , cached_method: :CallableMethod } ,
|
CacheEntry: {cached_type: :Type , cached_method: :CallableMethod } ,
|
||||||
Callable: {binary: :BinaryCode,next: :Callable ,
|
Callable: {binary: :BinaryCode,next: :Callable ,
|
||||||
arguments_type: :Type , self_type: :Type, frame_type: :Type } ,
|
arguments_type: :Type , self_type: :Type, frame_type: :Type } ,
|
||||||
CallableMethod: {name: :Word, binary: :BinaryCode,
|
CallableMethod: {binary: :BinaryCode, next: :CallableMethod ,
|
||||||
arguments_type: :Type , self_type: :Type, frame_type: :Type ,
|
arguments_type: :Type , self_type: :Type, frame_type: :Type ,
|
||||||
next: :CallableMethod} ,
|
name: :Word , blocks: :Block} ,
|
||||||
Class: {instance_methods: :List, instance_type: :Type,
|
Class: {instance_methods: :List, instance_type: :Type,
|
||||||
name: :Word, super_class_name: :Word },
|
name: :Word, super_class_name: :Word },
|
||||||
DataObject: {},
|
DataObject: {},
|
||||||
|
@ -99,5 +99,12 @@ module Parfait
|
|||||||
method = Parfait::CallableMethod.new( @obj , :other , @args , @frame)
|
method = Parfait::CallableMethod.new( @obj , :other , @args , @frame)
|
||||||
assert @method != method
|
assert @method != method
|
||||||
end
|
end
|
||||||
|
def test_create_block
|
||||||
|
@block = @method.create_block(@args , @frame)
|
||||||
|
assert_equal Block , @block.class
|
||||||
|
end
|
||||||
|
def test_has_block
|
||||||
|
assert_equal 7 , @method.get_type.variable_index( :blocks )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,6 +13,14 @@ module Risc
|
|||||||
end
|
end
|
||||||
alias :do_setup :setup
|
alias :do_setup :setup
|
||||||
|
|
||||||
|
def yielder
|
||||||
|
"def yielder; yield ; end"
|
||||||
|
end
|
||||||
|
|
||||||
|
def block_main( main , extra = yielder)
|
||||||
|
in_Space("#{extra} ; def main(arg) ; #{main} ; end")
|
||||||
|
end
|
||||||
|
|
||||||
# check the given array of instructions is what the interpreter actually does
|
# check the given array of instructions is what the interpreter actually does
|
||||||
# possible second argument ignores the given amount, usually up until main
|
# possible second argument ignores the given amount, usually up until main
|
||||||
def check_chain( should , start_at = 0 )
|
def check_chain( should , start_at = 0 )
|
||||||
|
Loading…
Reference in New Issue
Block a user