Skip to content

Commit

Permalink
fixes orig's return value not being stored or returned. Prep work fo…
Browse files Browse the repository at this point in the history
…r allowing postfixes to modify return data
  • Loading branch information
Robin authored and AlbinoGeek committed May 19, 2024
1 parent ee9803c commit a6d1c24
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion flowerful.patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,26 @@ function Apply(patch: FlowerPatch)
}
}

let origRet;

try
{
orig.call(patch.obj, ...args);
origRet = orig.call(patch.obj, ...args);
}
catch (e)
{
WriteLog("Flower", `Error running orig: ${e}`)
return;
}

/**
* Todo: allow postfixes to modify the return data here
*/

WriteDebug(`Postfixes ${patch.postfixes.length}`);
patch.postfixes.forEach(postfix => postfix.call(patch.obj, ...args));

return origRet;
}

patch.obj[patch.methodName] = wrapper.bind(patch.obj);
Expand Down

1 comment on commit a6d1c24

@RobynLlama
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes #8

Please sign in to comment.