Class: Y2R::AST::YCP::Builtin
- Defined in:
- lib/y2r/ast/ycp.rb
Instance Method Summary collapse
Methods inherited from Node
#always_returns?, #compile_as_copy_if_needed, #compile_statements, #compile_statements_inside_block, #compile_statements_with_whitespace, #creates_local_scope?, #needs_copy?, #never_nil?, #optimize_last_statement, #optimize_next, #optimize_return, #remove_duplicate_imports, transfers_comments
Instance Method Details
#compile(context) ⇒ Object
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 |
# File 'lib/y2r/ast/ycp.rb', line 892 def compile(context) module_name = case ns when "SCR" "SCR" when "WFM" "WFM" when "float" "Builtins::Float" when "list" "Builtins::List" when "multiset" "Builtins::Multiset" else "Builtins" end Ruby::MethodCall.new( :receiver => Ruby::Variable.new(:name => module_name), :name => name, :args => args.map { |a| a.compile(context) }, :block => block ? block.compile_as_block(context) : nil, :parens => true ) end |