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

Unified Diff: tools/dom/src/native_DOMImplementation.dart

Issue 23514061: Cleanup bugs in wrapExpressionAsClosure Fix bug in how setters were handled and filter out 'this' f… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/src/native_DOMImplementation.dart
diff --git a/tools/dom/src/native_DOMImplementation.dart b/tools/dom/src/native_DOMImplementation.dart
index 2a063c0f491e188066d7cad1a7b6f1d6f5388473..65e117b44a35163a0e5c4ad992d8993be92c4630 100644
--- a/tools/dom/src/native_DOMImplementation.dart
+++ b/tools/dom/src/native_DOMImplementation.dart
@@ -15,6 +15,8 @@ class _ConsoleVariables {
if (invocation.isGetter) {
return _data[member];
} else if (invocation.isSetter) {
+ assert(member.endsWith('='));
+ member = member.substring(0, member.length - 1);
_data[member] = invocation.positionalArguments[0];
} else {
return Function.apply(_data[member], invocation.positionalArguments, invocation.namedArguments);
@@ -133,7 +135,9 @@ class _Utils {
* expression for a closure with a body matching the original expression
* where locals are passed in as arguments. Returns a list containing the
* String expression for the closure and the list of arguments that should
- * be passed to it.
+ * be passed to it. The expression should then be evaluated using
+ * Dart_EvaluateExpr which will generate a closure that should be invoked
+ * with the list of arguments passed to this method.
*
* For example:
* <code>wrapExpressionAsClosure("foo + bar", ["bar", 40, "foo", 2])</code>
@@ -146,6 +150,12 @@ class _Utils {
addArg(arg, value) {
arg = stripMemberName(arg);
if (args.containsKey(arg)) return;
+ // We ignore arguments with the name 'this' rather than throwing an
+ // exception because Dart_GetLocalVariables includes 'this' and it
+ // is more convenient to filter it out here than from C++ code.
+ // 'this' needs to be handled by calling Dart_EvaluateExpr with
+ // 'this' as the target rather than by passing it as an argument.
+ if (arg == 'this') return;
if (args.isNotEmpty) {
sb.write(", ");
}
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698