Class: Peruby::Op::Use
Overview
Compile-time pragmas and registered core modules; loading expands in P12.
Constant Summary collapse
- CORE =
ModuleLoader::INTERNAL_MODULES
Instance Method Summary collapse
-
#initialize(module_name, imports, disable, package) ⇒ Use
constructor
A new instance of Use.
-
#run(env, context) ⇒ Object
rubocop:disable Metrics/AbcSize.
- #warning_directive? ⇒ Boolean
Methods inherited from Base
#argument_cells, #local_slot, #lvalue, #run_subroutine, #to_callable
Constructor Details
#initialize(module_name, imports, disable, package) ⇒ Use
Returns a new instance of Use.
809 810 811 812 813 814 |
# File 'lib/peruby/op/builtin.rb', line 809 def initialize(module_name, imports, disable, package) @module_name = module_name @imports = imports @disable = disable @package = package end |
Instance Method Details
#run(env, context) ⇒ Object
rubocop:disable Metrics/AbcSize
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 |
# File 'lib/peruby/op/builtin.rb', line 816 def run(env, context) # rubocop:disable Metrics/AbcSize imports, version, suppress = env.configure_strict(imports, disable: @disable) if @module_name == 'strict' env.runtime.configure_warnings(imports, disable: @disable) if @module_name == 'warnings' configure_inc(env, imports) if @module_name == 'lib' && !@disable env.runtime.module_loader.require_module(@module_name) unless @disable configure_inheritance(env, imports) if %w[parent base].include?(@module_name) && !@disable configure_overload(env, imports) if @module_name == 'overload' check_version(env, version) if version invoke_import(env, imports, suppress) alias_imports(env, imports) unless @disable || suppress if %w[Test::More Test::Simple].include?(@module_name) && imports.first == 'tests' env.runtime.test_builder.plan(imports.last) end context == :list ? [Scalar.new(1)] : 1 end |
#warning_directive? ⇒ Boolean
833 |
# File 'lib/peruby/op/builtin.rb', line 833 def warning_directive? = @module_name == 'warnings' |