basic require_relative (hack)
opted to hack require to be getting on need require for the test helper and the files in lib/parfait General require mechanism would still be ok, but require_ralative means implementing file source, which needs to be dragged around. I'll make an issue
This commit is contained in:
@ -6,13 +6,27 @@ module Ruby
|
||||
class SendStatement < CallStatement
|
||||
|
||||
def to_vool
|
||||
return super unless @receiver.is_a?(ModuleName) and @receiver.name == :X
|
||||
args = @arguments.collect { |arg| arg.to_vool }
|
||||
Vool::MacroExpression.new(name , args)
|
||||
if @receiver.is_a?(ModuleName) and @receiver.name == :X
|
||||
args = @arguments.collect { |arg| arg.to_vool }
|
||||
return Vool::MacroExpression.new(name , args)
|
||||
end
|
||||
return require_file if( @name == :require_relative )
|
||||
return super
|
||||
end
|
||||
def to_s(depth = 0)
|
||||
at_depth( depth , "#{receiver}.#{name}(#{arguments.join(', ')})")
|
||||
end
|
||||
def require_file
|
||||
target = @arguments.first.value
|
||||
if(target == 'helper')
|
||||
file = "/test/rubyx/rt_parfait/helper.rb"
|
||||
else
|
||||
file = "/lib/parfait/#{target}.rb"
|
||||
end
|
||||
path = File.expand_path( "../../../#{file}" , __FILE__)
|
||||
source = File.read(path)
|
||||
RubyCompiler.compile( source ).to_vool
|
||||
end
|
||||
end
|
||||
class SuperStatement < SendStatement
|
||||
def initialize(args)
|
||||
|
Reference in New Issue
Block a user