From 2a24c4f8aa1cb45d36c182099d012ea345ac10d2 Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 28 Jun 2004 16:56:17 +0000 Subject: [PATCH] Committing patch from Rashid to call postCompile() function if it is defined after a prototype has been evaluated. --- src/helma/scripting/rhino/RhinoCore.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/helma/scripting/rhino/RhinoCore.java b/src/helma/scripting/rhino/RhinoCore.java index 9397a15e..8dbdebe9 100644 --- a/src/helma/scripting/rhino/RhinoCore.java +++ b/src/helma/scripting/rhino/RhinoCore.java @@ -258,6 +258,17 @@ public final class RhinoCore { type.compiledFunctions = newFunctions; type.lastUpdate = prototype.getLastUpdate(); + + // If this prototype defines a postCompile() function, call it + Context cx = Context.getCurrentContext(); + try { + Object fObj = op.get("postCompile",op); + if (fObj instanceof Function) { + ((Function) fObj).call(cx, global, op, new Object[0]); + } + } catch (Exception x) { + app.logError("Exception in "+prototype.getName()+".postCompile(): " + x, x); + } } /**