Chromium Code Reviews| Index: sdk/lib/js/dartium/js_dartium.dart |
| diff --git a/sdk/lib/js/dartium/js_dartium.dart b/sdk/lib/js/dartium/js_dartium.dart |
| index 4a4b46d1c28edd832ee803b6df48e523482c5c27..2c7c4ebb979f79904a267d75829a524f7bb155ac 100644 |
| --- a/sdk/lib/js/dartium/js_dartium.dart |
| +++ b/sdk/lib/js/dartium/js_dartium.dart |
| @@ -111,5 +111,40 @@ class JsFunction extends JsObject { |
| apply(List args, {thisArg}) native "JsFunction_apply"; |
| + /** |
| + * Internal only version of apply which uses debugger proxies of Dart objects |
| + * rather than opaque handles. This method is private because it cannot be |
| + * efficiently implemented in Dart2Js so should only be used by internal |
| + * tools. |
| + */ |
| + _applyDebuggerOnly(List args, {thisArg}) native "JsFunction_applyDebuggerOnly"; |
| + |
| static JsFunction _withThis(Function f) native "JsFunction_withThis"; |
| } |
| + |
| +/** |
| + * Placeholder object for cases where we need to determine exactly how many |
| + * args were passed to a function. |
| + */ |
| +const _UNDEFINED = const Object(); |
| + |
| +// FIXME(jacobr): this method is a hack to work around the lack of proper dart |
| +// support for varargs methods. |
| +List _stripUndefinedArgs(List args) { |
|
justinfagnani
2013/10/23 00:54:03
this could be: args.takeWhile((i) => i != _UNDEFIN
Jacob
2013/10/23 01:26:13
yep. done.
|
| + for (int i = 0; i < args.length; i++) { |
| + if (i == _UNDEFINED) { |
| + return args.sublist(0, i); |
| + } |
| + } |
| + return args; |
| +} |
| + |
| +/** |
| + * Returns a method that can be called with an arbitrary number (for n less |
| + * than 11) of arguments without violating Dart type checks. |
| + */ |
| +Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) => |
| + ([a1=_UNDEFINED, a2=_UNDEFINED, a3=_UNDEFINED, a4=_UNDEFINED, a5=_UNDEFINED, |
| + a6=_UNDEFINED, a7=_UNDEFINED, a8=_UNDEFINED, a9=_UNDEFINED, a10=_UNDEFINED]) => |
|
justinfagnani
2013/10/23 00:54:03
> 80 cols
Jacob
2013/10/23 01:26:13
Done.
|
| + // FIXME: switch to _applyDebugger |
| + jsFunction._applyDebuggerOnly(_stripUndefinedArgs([a1,a2,a3,a4,a5,a6,a7,a8,a9,a10])); |