Skip to content

Execution Flow

Andreas Pardeike edited this page Jan 13, 2017 · 5 revisions

Patching a method does not override any previous patches that other users of Harmony apply to the same method. Instead, prefix and postfix patches are executed in a prioritised way. Prefix patches return a boolean that, if false, terminates prefixes and skips the execution of the original method. In contrast, all postfixes are executed all the time.

Execution of prefixes and postfixes can explained best with the following pseudo code:

bool run = true
Customer result = null;

if (run) run = Prefix1(instance, ref result, ref count)
if (run) run = Prefix2(instance, ref result, ref count)
// ...

if (run) result = Original(result, count, out error)

Postfix1(instance, ref count, ref error)
Postfix2(instance, ref count, ref error)
// ...

return result

Next: Priorities annotations

Clone this wiki locally