Module: Seafoam::Passes::TruffleTranslators
- Defined in:
- lib/seafoam/passes/truffle_translators/default.rb,
lib/seafoam/passes/truffle_translators/translators.rb,
lib/seafoam/passes/truffle_translators/truffleruby.rb
Defined Under Namespace
Classes: Default, TruffleRuby
Constant Summary collapse
- TRUFFLE_LANGUAGES =
{ "org.truffleruby" => "TruffleRuby", }
Class Method Summary collapse
Class Method Details
.get_translator(node) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/seafoam/passes/truffle_translators/translators.rb', line 16 def get_translator(node) translator = node.visit_outputs(:bfs) do |entry| declaring_class = entry.props["code"] || entry.props.dig("nodeSourcePosition", :method) if declaring_class subpackage = declaring_class[:declaring_class].match(/^(\w+\.\w+)\./)[1] translator = TRUFFLE_LANGUAGES[subpackage] unless translator Seafoam::Graal::Source.walk(entry.props.dig("nodeSourcePosition")) do |method| declaring_class = method[:declaring_class] subpackage = declaring_class.match(/^(\w+\.\w+)\./)[1] translator = TRUFFLE_LANGUAGES[subpackage] break if translator end end break const_get(translator).new if translator end end translator || Default.new end |