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 87ed08b8be5d1f2e588da66be9c372c3a37a7f5b..1c778719df1ab84ff1059e6b4a0bdfb62c059c85 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 |
@@ -540,3 +540,16 @@ defineNamedConstructorCallable(clazz, name, ctor) => JS( |
// like `caller` and `arguments`. |
$defineProperty($clazz, $name, { value: ctor, configurable: true }); |
})()'''); |
+ |
+defineEnumValues(enumClass, names) => JS( |
+ '', |
+ '''(() => { |
+ let values = []; |
+ for (var i = 0; i < $names.length; i++) { |
+ let value = $const_(new $enumClass(i)); |
+ values.push(value); |
+ Object.defineProperty($enumClass, $names[i], |
+ { value: value, configurable: true }); |
+ } |
+ $enumClass.values = $constList(values, $enumClass); |
+})()'''); |