svoid test_tok_eventFunctions() { // no args testTranspilationFunction tok_eventFunctions( "event blubb;", [[ transient LinkedHashSet onBlubb; public selfType onBlubb(Runnable r) { onBlubb = createOrAddToSyncLinkedHashSet(onBlubb, r); this; } public selfType removeBlubbListener(Runnable r) { main remove(onBlubb, r); this; } void blubb() { pcallFAll(onBlubb); } ]]); // with args testTranspilationFunction tok_eventFunctions( "event newX(X x);", [[ transient LinkedHashSet> onNewX; public selfType onNewX(IVF1 f) { onNewX = createOrAddToSyncLinkedHashSet(onNewX, f); this; } public selfType removeNewXListener(IVF1 f) { main remove(onNewX, f); this; } void newX(X x) { pcallFAll(onNewX, x); } ]]); // "on" prefix handled correctly testTranspilationFunction tok_eventFunctions( "event onBlubb;", [[ transient LinkedHashSet onBlubb; public selfType onBlubb(Runnable r) { onBlubb = createOrAddToSyncLinkedHashSet(onBlubb, r); this; } public selfType removeBlubbListener(Runnable r) { main remove(onBlubb, r); this; } void blubb() { pcallFAll(onBlubb); } ]]); // "fire" prefix handled correctly testTranspilationFunction tok_eventFunctions( "event fireBlubb;", [[ transient LinkedHashSet onBlubb; public selfType onBlubb(Runnable r) { onBlubb = createOrAddToSyncLinkedHashSet(onBlubb, r); this; } public selfType removeBlubbListener(Runnable r) { main remove(onBlubb, r); this; } void fireBlubb() { pcallFAll(onBlubb); } ]]); // firing functions can now have a body testTranspilationFunction tok_eventFunctions( "event newX(X x) { bla; }", [[ transient LinkedHashSet> onNewX; public selfType onNewX(IVF1 f) { onNewX = createOrAddToSyncLinkedHashSet(onNewX, f); this; } public selfType removeNewXListener(IVF1 f) { main remove(onNewX, f); this; } void newX(X x) { bla; pcallFAll(onNewX, x); } ]]); }