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

Unified Diff: lib/html/dart2js/html_dart2js.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 10870030: Conversions between JavaScript objects and Maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « no previous file | lib/html/src/dart2js_Conversions.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/dart2js/html_dart2js.dart
diff --git a/lib/html/dart2js/html_dart2js.dart b/lib/html/dart2js/html_dart2js.dart
index f14d542ece8c287e904e992bee7470d7e1c6c9bb..5ba916d5c536c404b98c0187c8c65b801560856c 100644
--- a/lib/html/dart2js/html_dart2js.dart
+++ b/lib/html/dart2js/html_dart2js.dart
@@ -38573,15 +38573,23 @@ _convertDartToNative_ImageData(ImageData imageData) {
/// Converts a JavaScript object with properties into a Dart Map.
+/// Not suitable for nested objects.
Map _convertNativeToDart_Dictionary(object) {
// TODO: Implement.
- return object;
+ var dict = {};
+ for (final key in JS('List', 'Object.getOwnPropertyNames(#)', object)) {
+ dict[key] = JS('var', '#[#]', object, key);
+ }
+ return dict;
}
-/// Converts a Dart map into a JavaScript object with properties.
+/// Converts a flat Dart map into a JavaScript object with properties.
_convertDartToNative_Dictionary(Map dict) {
- // TODO: Implement.
- return dict;
+ var object = JS('var', '{}');
+ dict.forEach((String key, value) {
+ JS('void', '#[#] = #', object, key, value);
+ });
+ return object;
}
« no previous file with comments | « no previous file | lib/html/src/dart2js_Conversions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698