fix class statements to always have Statements as body

not sometimes an array, which sits badly in the tree of statements
This commit is contained in:
Torsten Ruger
2017-04-09 09:59:21 +03:00
parent a6e87491cd
commit 397eca541a
2 changed files with 24 additions and 3 deletions

View File

@ -4,7 +4,11 @@ module Vool
attr_reader :clazz
def initialize( name , supe , body)
@name , @super_class_name , @body = name , supe , (body || [])
@name , @super_class_name , @body = name , supe , body
unless( body.is_a?(ScopeStatement))
@body = ScopeStatement.new([])
@body.statements << body if body
end
end
def collect(arr)
@ -25,6 +29,7 @@ module Vool
vars.each { |var| ivar_hash[var] = :Object }
@clazz.set_instance_type( Parfait::Type.for_hash( @clazz , ivar_hash ) )
end
puts "BODY is #{body.class}"
body.collect([]).each {|node| node.set_class(@clazz) }
body.create_objects
end