Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart |
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart |
index d6f3423b7d6980e77c0caddf61502d10298f2b58..f6b12eb4e177eac173181c6cf0b940a1c307368c 100644 |
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart |
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart |
@@ -501,10 +501,13 @@ setBaseClass(derived, base) { |
/// Like [setBaseClass] but for generic extension types, e.g. `JSArray<E>` |
setExtensionBaseClass(derived, base) { |
- // Mark the generic type as an extension type. |
- JS('', '#.prototype[#] = #', derived, _extensionType, derived); |
- // Link the prototype objects |
- JS('', '#.prototype.__proto__ = #.prototype', derived, base); |
+ // Mark the generic type as an extension type and link the prototype objects |
+ return JS('', '''(() => { |
+ if ($base) { |
+ $derived.prototype[$_extensionType] = $derived; |
+ $derived.prototype.__proto__ = $base.prototype |
+ } |
+})()'''); |
} |
/// Given a special constructor function that creates a function instances, |