VarArgParser.Arguments parsedArgs = WGAGlobal._createObjectVarargs.parse(args);
// Retrieve object definition, either as script or as Function object
Object definition = parsedArgs.get("definition");
Function func;
if (definition instanceof Function) {
func = (Function) args[0];
}
else {
func = loadObjectDefinition(cx, design, args, funObj);
}
// Construct the object
Scriptable obj = func.construct(cx, thisObj, new Object[] {});
Scriptable topLevelScope = ScriptableObject.getTopLevelScope(thisObj);
// Put the action definition to the object, so it "knows" where it's
// definition came from
TMLAction action = (TMLAction) func.get(RhinoExpressionEngine.PARAM_ACTIONDEFINITION, func);
if (action != null) {
obj.put(RhinoExpressionEngine.PARAM_ACTIONDEFINITION, obj, action);
}
// Execute constructor