lib/finitio/system.rb in finitio-0.7.0 vs lib/finitio/system.rb in finitio-0.8.0
- old
+ new
@@ -8,11 +8,11 @@
@types = types
@imports = imports
end
attr_reader :types, :imports
- private :types, :imports
+ private :imports
def add_import(system)
@imports << system
end
@@ -85,9 +85,19 @@
end
def parse(source)
require_relative "syntax"
Syntax.compile(source, self.dup)
+ end
+
+ def resolve_proxies(recurse = true)
+ rebuilt = {}
+ scope = FetchScope.new(self, rebuilt)
+ types.each_with_object(rebuilt) do |(name,type),memo|
+ rebuilt[name] = type.resolve_proxies(scope)
+ end
+ resolved = System.new(rebuilt, imports)
+ recurse ? resolved.resolve_proxies(false) : resolved
end
def inspect
@types.each_pair.map{|k,v| "#{k} = #{v}" }.join("\n")
end