Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1031820 // dm_replaceModuleInstance - replace module's instance with a new one

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (13141L/80K).

// pretty dirty, especially regarding cleanup of main classes
svoid dm_replaceModuleInstance(DynModule newInstance) {
  assertNotNull(newInstance);
  O stem = dm_stem_mandatory();
  O oldInstance = get(stem, "o");
  if (oldInstance != newInstance) {
    print("Replacing instance for module " + dm_moduleID() + ": "
      + oldInstance + " => " + newInstance);
    set(stem, o := newInstance);
    
    // Revisualize because UI often has pointers into the module instance
    dm_revisualize();
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031820
Snippet name: dm_replaceModuleInstance - replace module's instance with a new one
Eternal ID of this version: #1031820/4
Text MD5: 560194d803510814c39e14634a410443
Transpilation MD5: d94d587ddbbfde28dfe8f73213fd45fb
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-07-11 16:30:41
Source code size: 513 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 66 / 103
Version history: 3 change(s)
Referenced in: [show references]