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

22
LINES

< > BotCompany Repo | #1031850 // convertObjectMetaToMap

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

Libraryless. Compilation Failed (5208L/30K).

static Map convertObjectMetaToMap(IMeta o, IF0<Map> createEmptyMap default () -> makeObjectMetaMap()) {
  if (o == null) null;
  
  // The following shortcut depends on the assumption that a meta field never reverts
  // to null when it was a map
  ifndef MetaCanRevertToNull
    O meta = o._getMeta();
    if (meta cast Map) ret meta;
  endifndef
  
  // non-shortcut path (create meta)
  temp var mutex = tempMetaMutex(o);
  var actualMutex = mutex!;
  synchronized(actualMutex) {
    meta = o._getMeta();
    if (meta cast Map) ret meta;
    Map map = createEmptyMap!;
    if (meta != null) map.put(previousMeta := meta);
    o._setMeta(map);
    ret map;
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031850
Snippet name: convertObjectMetaToMap
Eternal ID of this version: #1031850/9
Text MD5: 9a7b00e0544953352ce85f576f467410
Transpilation MD5: 7368dd3db7c4e5b56349c9108a352f3b
Author: stefan
Category: javax / reasoning
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-20 01:47:13
Source code size: 685 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 132 / 206
Version history: 8 change(s)
Referenced in: [show references]