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

Unified Diff: tool/input_sdk/private/ddc_runtime/utils.dart

Issue 1879373004: Implement modular compilation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 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 | « tool/input_sdk/private/ddc_runtime/runtime.dart ('k') | tool/node_test.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/private/ddc_runtime/utils.dart
diff --git a/tool/input_sdk/private/ddc_runtime/utils.dart b/tool/input_sdk/private/ddc_runtime/utils.dart
index a04c780a4f52035ca05c6e549b438b9c2bbce4ae..50ce364828e54df293250e0b8b16c842b1d36273 100644
--- a/tool/input_sdk/private/ddc_runtime/utils.dart
+++ b/tool/input_sdk/private/ddc_runtime/utils.dart
@@ -83,10 +83,22 @@ defineMemoizedGetter(obj, String name, getter) => JS('', '''(() => {
return $defineLazyProperty($obj, $name, {get: $getter});
})()''');
+
+// TODO(jmesserly): don't stomp on native Symbol.iterator.
+// We need to find a better solution for this.
+// See: https://github.com/dart-lang/dev_compiler/issues/487
copyTheseProperties(to, from, names) => JS('', '''(() => {
for (let name of $names) {
- var desc = $getOwnPropertyDescriptor($from, name);
+ let desc = $getOwnPropertyDescriptor($from, name);
if (desc != void 0) {
+ if (name == Symbol.iterator) {
+ // On native types, Symbol.iterator may already be present.
+ let existing = $getOwnPropertyDescriptor($to, name);
+ if (existing != null) {
+ if (existing.writable) $to[Symbol.iterator] = desc.value;
+ continue;
+ }
+ }
$defineProperty($to, name, desc);
} else {
$defineLazyProperty($to, name, () => $from[name]);
@@ -100,16 +112,3 @@ copyTheseProperties(to, from, names) => JS('', '''(() => {
copyProperties(to, from) => JS('', '''(() => {
return $copyTheseProperties($to, $from, $getOwnNamesAndSymbols($from));
})()''');
-
-/// Exports from one Dart module to another.
-@JSExportName('export')
-export_(to, from, show, hide) => JS('', '''(() => {
- if ($show == void 0 || $show.length == 0) {
- $show = $getOwnNamesAndSymbols($from);
- }
- if ($hide != void 0) {
- var hideMap = new Set($hide);
- $show = $show.filter((k) => !hideMap.has(k));
- }
- return $copyTheseProperties($to, $from, $show);
-})()''');
« no previous file with comments | « tool/input_sdk/private/ddc_runtime/runtime.dart ('k') | tool/node_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698