Libraryless. Compilation Failed (16746L/101K).
1 | // TODO: use weak reference to live value - or make each of them only once |
2 | |
3 | static SimpleLiveValue dm_fieldLiveValue(DynModule module default dm_current_mandatory(), S fieldName) { |
4 | lock module.lock; |
5 | temp module.enter(); // for dm_watchField |
6 | Class type = getFieldType(module, fieldName); |
7 | final SimpleLiveValue value = new(type, get(module, fieldName)); |
8 | dm_watchField(fieldName, r { |
9 | ifdef dm_fieldLiveValue_debug |
10 | print("dm_fieldLiveValue: setting " + fieldName); |
11 | endifdef |
12 | O o = get(module, fieldName); |
13 | ifdef dm_fieldLiveValue_debug |
14 | print("dm_fieldLiveValue: setting " + fieldName + " = " + o); |
15 | endifdef |
16 | value.set(o); |
17 | ifdef dm_fieldLiveValue_debug |
18 | print("dm_fieldLiveValue: setting " + fieldName + " done"); |
19 | printStackTrace(); |
20 | endifdef |
21 | }); |
22 | value.onChange(r { |
23 | ifdef dm_fieldLiveValue_debug |
24 | print("dm_fieldLiveValue: setting 2 " + fieldName + " = " + value!); |
25 | endifdef |
26 | module.setField(fieldName, value!); |
27 | ifdef dm_fieldLiveValue_debug |
28 | print("dm_fieldLiveValue: setting 2 " + fieldName + " done"); |
29 | endifdef |
30 | }); |
31 | ret value; |
32 | } |
33 | |
34 | static SimpleLiveValue dm_fieldLiveValue(S fieldName, DynModule module) { |
35 | ret dm_fieldLiveValue(module, fieldName); |
36 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1015971 |
Snippet name: | dm_fieldLiveValue - live-value for a field in DynModule. should also work with transient fields |
Eternal ID of this version: | #1015971/19 |
Text MD5: | 3347e7cafefa2ca274688b5d7dd1a50c |
Transpilation MD5: | 818ed4290d9711abe09efa8376e1507a |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-29 04:20:00 |
Source code size: | 1279 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 560 / 710 |
Version history: | 18 change(s) |
Referenced in: | [show references] |