2 function keyword_argument(name, value)
8 function keyword_argument_forwarder(args)
13 function _get_keyword_argument_setter(name) {
14 return function (value) { return new keyword_argument(name, value); }
17 function _get_keyword_argument_getter(name) {
18 return function () { return new keyword_argument(name, true); }
21 // This function must be called with all string arguments, all of
22 // which must begin with "$".
23 function define_keywords()
25 for (var i = 0; i < arguments.length; ++i)
27 var name = arguments[i];
28 this.__defineSetter__(name, _get_keyword_argument_setter(name));
29 this.__defineGetter__(name, _get_keyword_argument_getter(name));
33 var define_keyword = define_keywords;
35 function forward_keywords(args)
37 return new keyword_argument_forwarder(args);
40 // This is called with a function's `arguments' variable. Additional
41 // default values can also be specified as subsequent arguments.
42 function keywords(args)
44 /* First add our own arguments. */
45 for (var i = 1; i < arguments.length; ++i)
47 var arg = arguments[i];
48 args[arg.name] = arg.value;
50 function helper(in_args)
52 for (var i = 0; i < in_args.length; ++i)
55 if (arg instanceof keyword_argument)
56 args[arg.name] = arg.value;
57 else if (arg instanceof keyword_argument_forwarder)