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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 23533055: https://codereview.chromium.org//23754012 resulted in some changes to the generated files but (Closed) Base URL: http://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:
Download patch
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dartium/html_dartium.dart
===================================================================
--- sdk/lib/html/dartium/html_dartium.dart (revision 27448)
+++ sdk/lib/html/dartium/html_dartium.dart (working copy)
@@ -7456,10 +7456,11 @@
@DocsEditable()
/**
- * Represents an HTML <div> element.
+ * A generic container for content on an HTML page;
+ * corresponds to the &lt;div&gt; tag.
*
- * The [DivElement] is a generic container for content and does not have any
- * special significance. It is functionally similar to [SpanElement].
+ * The [DivElement] is a generic container and does not have any semantic
+ * significance. It is functionally similar to [SpanElement].
*
* The [DivElement] is a block-level element, as opposed to [SpanElement],
* which is an inline-level element.
@@ -34482,6 +34483,31 @@
// BSD-style license that can be found in the LICENSE file.
+class _ConsoleVariables {
+ Map<String, Object> _data = new Map<String, Object>();
+
+ /**
+ * Forward member accesses to the backing JavaScript object.
+ */
+ noSuchMethod(Invocation invocation) {
+ String member = MirrorSystem.getName(invocation.memberName);
+ if (invocation.isGetter) {
+ return _data[member];
+ } else if (invocation.isSetter) {
+ _data[member] = invocation.positionalArguments[0];
+ } else {
+ return Function.apply(_data[member], invocation.positionalArguments, invocation.namedArguments);
+ }
+ }
+
+ void clear() => _data.clear();
+
+ /**
+ * List all variables currently defined.
+ */
+ List variables() => _data.keys.toList(growable: false);
+}
+
class _Utils {
static double dateTimeToDouble(DateTime dateTime) =>
dateTime.millisecondsSinceEpoch.toDouble();
@@ -34580,7 +34606,42 @@
return map;
}
+ static _ConsoleVariables _consoleTempVariables = new _ConsoleVariables();
/**
+ * Takes an [expression] and a list of [local] variable and returns an
+ * 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.
+ *
+ * For example:
+ * <code>wrapExpressionAsClosure("foo + bar", ["bar", 40, "foo", 2])</code>
+ * will return:
+ * <code>["(final $var, final bar, final foo) => foo + bar", [40, 2]]</code>
+ */
+ static List wrapExpressionAsClosure(String expression, List locals) {
+ var args = {};
+ var sb = new StringBuffer("(");
+ addArg(arg, value) {
+ arg = stripMemberName(arg);
+ if (args.containsKey(arg)) return;
+ if (args.isNotEmpty) {
+ sb.write(", ");
+ }
+ sb.write("final $arg");
+ args[arg] = value;
+ }
+
+ addArg("\$var", _consoleTempVariables);
+
+ for (int i = 0; i < locals.length; i+= 2) {
+ addArg(locals[i], locals[i+1]);
+ }
+ sb..write(')=>\n$expression');
+ return [sb.toString(), args.values.toList(growable: false)];
+ }
+
+ /**
* Convenience helper to get the keys of a [Map] as a [List].
*/
static List getMapKeyList(Map map) => map.keys.toList();
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698