move the code insertion functionality up to function. makes more sense. block still carries code though

This commit is contained in:
Torsten Ruger
2014-06-10 23:57:56 +03:00
parent e9fc8ac6aa
commit e9519d4f05
15 changed files with 130 additions and 115 deletions

View File

@ -24,9 +24,9 @@ module Fragments
# and the last is wrapped as a main
parts.each_with_index do |part,index|
if part.is_a? Ast::FunctionExpression
expr = part.compile( @object_space.context , nil )
expr = part.compile( @object_space.context )
else
expr = part.compile( @object_space.context , @object_space.main )
expr = part.compile( @object_space.context )
end
end
end

View File

@ -65,9 +65,9 @@ HERE
# and the last is wrapped as a main
parts.each_with_index do |part,index|
if index == (parts.length - 1)
expr = part.compile( @object_space.context , @object_space.main )
expr = part.compile( @object_space.context )
else
expr = part.compile( @object_space.context , nil )
expr = part.compile( @object_space.context )
raise "should be function definition for now, not #{part.inspect}#{expr.inspect}" unless expr.is_a? Vm::BootClass
end
end