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

Unified Diff: sdk/lib/html/html_common/conversions_dartium.dart

Issue 1720743005: Generation of sdk/lib files from 45 roll (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with TOT Created 4 years, 10 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 | sdk/lib/html/html_common/html_common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/html_common/conversions_dartium.dart
diff --git a/sdk/lib/html/html_common/conversions_dartium.dart b/sdk/lib/html/html_common/conversions_dartium.dart
index 3e3e5c10529b126d8d37063ab1ca17b996117080..3c358175e88b489b45241bbf8228309bfb3754fd 100644
--- a/sdk/lib/html/html_common/conversions_dartium.dart
+++ b/sdk/lib/html/html_common/conversions_dartium.dart
@@ -97,6 +97,31 @@ convertDartToNative_Dictionary(Map dict) {
return jsObject;
}
+// Creates a Dart class to allow members of the Map to be fetched (as if getters exist).
+// TODO(terry): Need to use package:js but that's a problem in dart:html. Talk to
+// Jacob about how to do this properly using dart:js.
+class _ReturnedDictionary {
+ Map _values;
+
+ noSuchMethod(InvocationMirror invocation) {
+ var key = MirrorSystem.getName(invocation.memberName);
+ if (invocation.isGetter) {
+ return _values[key];
+ } else if (invocation.isSetter && key.endsWith('=')) {
+ key = key.substring(0, key.length-1);
+ _values[key] = invocation.positionalArguments[0];
+ }
+ }
+
+ Map get toMap => _values;
+
+ _ReturnedDictionary(Map value): _values = value;
+}
+
+// Helper function to wrapped a returned dictionary from blink to a Dart looking
+// class.
+convertNativeDictionaryToDartDictionary(Map values) => new _ReturnedDictionary(values);
+
// Conversion function place holder (currently not used in dart2js or dartium).
List convertDartToNative_StringArray(List<String> input) => input;
« no previous file with comments | « no previous file | sdk/lib/html/html_common/html_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698