Commit 6edbfd9
[ddc] Updating representation of enums to support hot reload semantics.
Enums are now split between pre and post canonicalization members. A
separate operation during link-time is emitted for every const
enum field. These are required during link time since enhanced enums can have non-trivial type hierarchies.
Example for snippet:
```
enum E {
e1(1), ...
const E(this.i);
final int i;
}
```
Used to emit enum fields as:
```
dart.defineLazy(CT, {
get C1() {
return C[1] = dart.const(Object.setPrototypeOf({
[_Enum__name]: "e1",
[_Enum_index]: 0
i: 1
}, E.prototype));
},
}
```
Now emits them as:
```
// Declaration-time
dart.defineLazy(CT, {
get C1() {
return C[1] = dart.const(Object.setPrototypeOf({
[_Enum__name]: "e1",
}, E.prototype));
},
}
// Link-time
dart.extendEnum(dart.const(Object.setPrototypeOf({
[_Enum__name]: "e1"
}, E.prototype)), {
i: 1,
get index() {
return E.values.indexOf(this);
}
});
```
Change-Id: Id5ce2ec117e59d8daa28df7fe6051e4a7e1a5bc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404723
Commit-Queue: Mark Zhou <[email protected]>
Reviewed-by: Nicholas Shahan <[email protected]>1 parent 048b4ac commit 6edbfd9
File tree
2 files changed
+91
-8
lines changed- pkg/dev_compiler/lib/src/kernel
- sdk/lib/_internal/js_dev_runtime/private/ddc_runtime
2 files changed
+91
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
351 | 354 | | |
352 | 355 | | |
353 | 356 | | |
| |||
1011 | 1014 | | |
1012 | 1015 | | |
1013 | 1016 | | |
| 1017 | + | |
| 1018 | + | |
1014 | 1019 | | |
1015 | 1020 | | |
1016 | 1021 | | |
| |||
7942 | 7947 | | |
7943 | 7948 | | |
7944 | 7949 | | |
| 7950 | + | |
| 7951 | + | |
| 7952 | + | |
| 7953 | + | |
| 7954 | + | |
| 7955 | + | |
| 7956 | + | |
| 7957 | + | |
| 7958 | + | |
| 7959 | + | |
| 7960 | + | |
| 7961 | + | |
| 7962 | + | |
| 7963 | + | |
| 7964 | + | |
| 7965 | + | |
| 7966 | + | |
| 7967 | + | |
| 7968 | + | |
| 7969 | + | |
| 7970 | + | |
| 7971 | + | |
| 7972 | + | |
| 7973 | + | |
| 7974 | + | |
| 7975 | + | |
| 7976 | + | |
| 7977 | + | |
| 7978 | + | |
| 7979 | + | |
| 7980 | + | |
| 7981 | + | |
| 7982 | + | |
| 7983 | + | |
| 7984 | + | |
| 7985 | + | |
| 7986 | + | |
| 7987 | + | |
| 7988 | + | |
| 7989 | + | |
| 7990 | + | |
| 7991 | + | |
| 7992 | + | |
| 7993 | + | |
| 7994 | + | |
| 7995 | + | |
| 7996 | + | |
| 7997 | + | |
| 7998 | + | |
| 7999 | + | |
| 8000 | + | |
| 8001 | + | |
| 8002 | + | |
| 8003 | + | |
| 8004 | + | |
| 8005 | + | |
| 8006 | + | |
| 8007 | + | |
| 8008 | + | |
| 8009 | + | |
| 8010 | + | |
| 8011 | + | |
| 8012 | + | |
| 8013 | + | |
| 8014 | + | |
| 8015 | + | |
7945 | 8016 | | |
7946 | 8017 | | |
7947 | 8018 | | |
| |||
7950 | 8021 | | |
7951 | 8022 | | |
7952 | 8023 | | |
| 8024 | + | |
| 8025 | + | |
| 8026 | + | |
| 8027 | + | |
| 8028 | + | |
| 8029 | + | |
7953 | 8030 | | |
7954 | 8031 | | |
7955 | 8032 | | |
7956 | 8033 | | |
7957 | | - | |
7958 | | - | |
7959 | | - | |
7960 | | - | |
7961 | | - | |
7962 | | - | |
7963 | | - | |
| 8034 | + | |
| 8035 | + | |
7964 | 8036 | | |
7965 | 8037 | | |
7966 | 8038 | | |
| |||
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1375 | 1375 | | |
1376 | 1376 | | |
1377 | 1377 | | |
1378 | | - | |
| 1378 | + | |
| 1379 | + | |
1379 | 1380 | | |
1380 | 1381 | | |
1381 | 1382 | | |
| |||
1428 | 1429 | | |
1429 | 1430 | | |
1430 | 1431 | | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
0 commit comments