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

15
LINES

< > BotCompany Repo | #1019609 // dm_javaEvalOrInterpret - try to interpret code if possible; use callAndMake

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

Libraryless. Click here for Pure Java version (13104L/89K).

static O dm_javaEvalOrInterpret(S code) {
  final O module = dm_current_generic(); // dm_current_mandatory_generic();
  code = trim(code);
  if (canQuickEval(code)) ret quickEval(code);
  Pair<S, L<S>> p = tok_parseFunctionCall(code);
  if (p != null) {
    if (module != null) makeAndCall_setInitInThread(func(Class c) -> AutoCloseable {
      shareMyCreatorWith(c);
      InheritableThreadLocal<WeakReference> tl = cast getOpt(c, 'dm_currentModule_value);
      ret tempSetTL(tl, weakRef(module));
    });
    ret callAndMake(p.a, toObjectArray(lmap dm_javaEvalOrInterpret(p.b)));
  }
  ret dm_javaEval(code);
}

Author comment

Began life as a copy of #1017575

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1019609
Snippet name: dm_javaEvalOrInterpret - try to interpret code if possible; use callAndMake
Eternal ID of this version: #1019609/12
Text MD5: 4ff369a93933346b1d751f149c70dd50
Transpilation MD5: 6183e6c82325ebd83ad272385eda8726
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-21 15:37:53
Source code size: 627 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 368 / 497
Version history: 11 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1025796 - dm_prepareMakeAndCallInThread - pass module/OS reference to functions called with makeAndCall