External/Tools/AS2API/api_loader.rb
# TODO: this structure sucks; responsibility for type resolution should be
#       entirely seperate from aggregation, not shoe-horned into this class
this structure sucks; responsibility for type resolution should be
entirely seperate from aggregation, not shoe-horned into this class
this structure sucks ; responsibility for type resolution should be entirely seperate from aggregation not shoe - horned into this class
def resolve_types
    qname_map = {}
    qname_map[AS_VOID.qualified_name] = AS_VOID
    @types.each do |type|
      qname_map[type.qualified_name] = type
    end
    @types.each do |type|
      local_namespace = qname_map.dup
      local_namespace[type.unqualified_name] = type
      import_types_into_namespace(type, local_namespace)
      import_packages_into_namespace(type, local_namespace)
      resolver = type.type_resolver
      resolver.each do |type_proxy|
	real_type = local_namespace[type_proxy.local_name]
	unless real_type
	  real_type = maybe_parse_external_definition(type_proxy)
	end
	if real_type
	  type_proxy.resolved_type = real_type
	else
	  $stderr.puts "#{type.input_filename}:#{type_proxy.lineno}: Found no definition of type known locally as #{type_proxy.local_name.inspect}"
	end
      end
    end
  end
def resolve_types qname_map = { } qname_map [ AS_VOID . qualified_name ] = AS_VOID @types . each do | type | qname_map [ type . qualified_name ] = type end @types . each do | type | local_namespace = qname_map . dup local_namespace [ type . unqualified_name ] = type import_types_into_namespace ( type , local_namespace ) import_packages_into_namespace ( type , local_namespace ) resolver = type . type_resolver resolver . each do | type_proxy | real_type = local_namespace [ type_proxy . local_name ] unless real_type real_type = maybe_parse_external_definition ( type_proxy ) end if real_type type_proxy . resolved_type = real_type else $stderr . puts "#{type.input_filename}:#{type_proxy.lineno}: Found no definition of type known locally as #{type_proxy.local_name.inspect}" end end end end
TODO: this structure sucks; responsibility for type resolution should be
entirely seperate from aggregation, not shoe-horned into this class
TODO : this structure sucks ; responsibility for type resolution should be entirely seperate from aggregation not shoe - horned into this class
# Eeek!...