Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Unified Diff: sdk/lib/js/dartium/js_dartium.dart

Issue 35663003: Companion CL to support $0, $1, $2 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: PTAL Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/dom/src/native_DOMImplementation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5fcb5cedaca77fd21e8d7481ea01515733d3b681 100644
--- a/sdk/lib/js/dartium/js_dartium.dart
+++ b/sdk/lib/js/dartium/js_dartium.dart
@@ -111,5 +111,35 @@ 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) =>
+ args.takeWhile((i) => i != _UNDEFINED).toList();
+
+/**
+ * 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]) =>
+ jsFunction._applyDebuggerOnly(_stripUndefinedArgs(
+ [a1,a2,a3,a4,a5,a6,a7,a8,a9,a10]));
« no previous file with comments | « no previous file | tools/dom/src/native_DOMImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698