removed unused NamedList

args and locals got inlined into message, forgot to delete then
ripples out due to type creation
small type class api change, more ripples, but also more consistent
This commit is contained in:
2019-09-18 22:07:05 +03:00
parent 4b8ff52aa1
commit 38491d120b
15 changed files with 49 additions and 94 deletions

View File

@ -60,20 +60,24 @@ module Vool
#FIXME super class check with "sup"
#existing class, don't overwrite type (parfait only?)
else
@clazz = Parfait.object_space.create_class(@name , @super_class_name )
#TODO this should start from Object Type and add one name at a time.
# So the "trail" of types leading to this one exists.
# Also the Class always has a valid type.
ivar_hash = {}
self.each do |node|
next unless node.is_a?(InstanceVariable) or node.is_a?(IvarAssignment)
ivar_hash[node.name] = :Object
end
@clazz.set_instance_type( Parfait::Type.for_hash( @clazz , ivar_hash ) )
create_new_class
end
@clazz
end
def create_new_class
@clazz = Parfait.object_space.create_class(@name , @super_class_name )
#TODO this should start from Object Type and add one name at a time.
# So the "trail" of types leading to this one exists.
# Also the Class always has a valid type.
ivar_hash = {}
self.each do |node|
next unless node.is_a?(InstanceVariable) or node.is_a?(IvarAssignment)
ivar_hash[node.name] = :Object
end
@clazz.set_instance_type( Parfait::Type.for_hash( ivar_hash , @clazz ) )
end
def to_s(depth = 0)
at_depth(depth , "class #{name}" , @body.to_s(depth + 1) , "end")
end

View File

@ -25,7 +25,7 @@ module Vool
def make_arg_type( )
type_hash = {}
@args.each {|arg| type_hash[arg] = :Object }
Parfait::NamedList.type_for( type_hash )
Parfait::Type.for_hash( type_hash )
end
def to_s(depth = 0)
@ -43,7 +43,7 @@ module Vool
next unless node.is_a?(LocalVariable) or node.is_a?(LocalAssignment)
type_hash[node.name] = :Object
end
Parfait::NamedList.type_for( type_hash )
Parfait::Type.for_hash( type_hash )
end
end

View File

@ -48,7 +48,7 @@ module Vool
def make_arg_type( )
type_hash = {}
@args.each {|arg| type_hash[arg] = :Object }
Parfait::NamedList.type_for( type_hash )
Parfait::Type.for_hash( type_hash )
end
def make_frame(compiler)
type_hash = {}
@ -57,7 +57,7 @@ module Vool
next if compiler.in_scope?(node.name)
type_hash[node.name] = :Object
end
Parfait::NamedList.type_for( type_hash )
Parfait::Type.for_hash( type_hash )
end
end

View File

@ -38,7 +38,7 @@ module Vool
type_hash = {}
@args.each {|arg| type_hash[arg] = :Object }
type_hash[:implicit_block] = :Block if has_yield?
Parfait::NamedList.type_for( type_hash )
Parfait::Type.for_hash( type_hash )
end
def to_s(depth = 0)
@ -60,7 +60,7 @@ module Vool
next unless node.is_a?(LocalVariable) or node.is_a?(LocalAssignment)
type_hash[node.name] = :Object
end
Parfait::NamedList.type_for( type_hash )
Parfait::Type.for_hash( type_hash )
end
end