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

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

Issue 1896343002: a few small dart:_runtime cleanups (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 | « test/codegen/expect/language-all.js ('k') | tool/input_sdk/private/ddc_runtime/types.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/private/ddc_runtime/rtti.dart
diff --git a/tool/input_sdk/private/ddc_runtime/rtti.dart b/tool/input_sdk/private/ddc_runtime/rtti.dart
index 9c80fe02fd5b03297cbe79f2cf0a78c6a61ed1f3..bff78606e7c020cb104088b5f0ffd57fa22dd652 100644
--- a/tool/input_sdk/private/ddc_runtime/rtti.dart
+++ b/tool/input_sdk/private/ddc_runtime/rtti.dart
@@ -145,24 +145,19 @@ _nonPrimitiveRuntimeType(obj) => JS('', '''(() => {
return result;
})()''');
-LazyTagged(infoFn) => JS('', '''(() => {
- class _Tagged {
- get [$_runtimeType]() {return $infoFn();}
- }
- return _Tagged;
-})()''');
+LazyTagged(infoFn) =>
+ JS('', 'class _Tagged { get [#]() {return #();} }', _runtimeType, infoFn);
-read(value) => JS('', '''(() => {
- return $value[$_runtimeType];
-})()''');
+read(value) => JS('', '#[#]', value, _runtimeType);
-tag(value, info) => JS('', '''(() => {
- $value[$_runtimeType] = $info;
-})()''');
+/// Tag the runtime type of [value] to be type [t].
+void tag(value, t) {
+ JS('', '#[#] = #', value, _runtimeType, t);
+}
-tagComputed(value, compute) => JS('', '''(() => {
- $defineProperty($value, $_runtimeType, { get: $compute });
-})()''');
+tagComputed(value, compute) {
+ JS('', '#(#, #, { get: # })', defineProperty, value, _runtimeType, compute);
+}
tagMemoized(value, compute) => JS('', '''(() => {
let cache = null;
« no previous file with comments | « test/codegen/expect/language-all.js ('k') | tool/input_sdk/private/ddc_runtime/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698