Class: Forthic::StartModuleWord
- Defined in:
- lib/forthic/words/start_module_word.rb
Instance Attribute Summary
Attributes inherited from Word
Instance Method Summary collapse
Methods inherited from Word
#get_location, #initialize, #set_location
Constructor Details
This class inherits a constructor from Forthic::Word
Instance Method Details
#execute(interp) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/forthic/words/start_module_word.rb', line 9 def execute(interp) # The app module is the only module with a blank name if name == "" interp.module_stack_push(interp.get_app_module) return end # If the module is used by the current module, push it onto the stack, otherwise # create a new module. mod = interp.cur_module.find_module(name) unless mod mod = ForthicModule.new(name) interp.cur_module.register_module(mod.name, mod.name, mod) # If we're at the app module, also register with interpreter if interp.cur_module.name == "" interp.register_module(mod) end end interp.module_stack_push(mod) end |